When trying to get Nginx to use a certain directory for css files, I cannot seem to get the path to resolve: I keep getting a 404.
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /etc/ssl/servercert.pem;
ssl_certificate_key /etc/ssl/serverkey.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /var/www/ssl;
location ~ ^/css/([a-z]+.css)$ {
try_files /home/server/css/$1 =404;
access_log /var/log/nginx/loc.log test;
}
}
I have tried combinations of alias and root in combination with the try_files but I cannot seem to get them to resolve. What is the proper method of accomplishing a server side rewrite to another directory in Nginx (I am migrating from Lighttpd)?