I've been banging around with the process of migrating a site from Apache to Nginx and I'm about to lose my mind. The virtual host doesn't want to serve static resources (css, js, etc.) and I can't seem to figure out why. The server block looks like this:
server {
listen 443 default_server ssl;
server_name dev.myproject.mydomain.net;
root /opt/dev/myproject;
index index.php;
ssl_certificate /etc/ssl/certs/server.crt;
ssl_certificate_key /etc/ssl/certs/server.pem;
access_log /var/log/nginx/vh.project.dev.access.log;
error_log /var/log/nginx/vh.project.dev.error.log;
location ~ ^/alias_name/(.*) {
alias /opt/dev/myproject/www/$1;
location ~ ^/alias_name/(.+\.php)$ {
alias /opt/dev/myprojectp/www/$1;
include /etc/nginx/conf/php;
}
}
location ~ \.php$ {
include /etc/nginx/conf/php;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
What am I missing? I know it's my inexperience with Nginx, but any advice would be much appreciated at this point.
Thanks.
UPDATE
This appears to be related to my alias which I was having trouble with before. If I point my document root to the alias location (/opt/dev/myprojectp/www
), and try to render static content without the alias, it renders fine. As soon as I throw the alias in the URL...not so much.