I am setting up nginx as a sort of static file server. For some reason it is only working when I go to 123.123.123.123/ or 123.123.123.123. However, when I go to 123.123.123.123/static/content/ or 123.123.123.123/static/content/another.mp3 it returns a 404 not found. Here is the config file that is located in /etc/nginx/sites-available and linked to /etc/nginx/sites-enabled. I am really stumped as to why it is not working.
Any pointers or tips would be appreciated.
server {
listen 123.123.123.123:80;
server_name "";
location / {
root /srv/homepage;
index index.html;
}
location /static/content/ {
root /srv/static/content;
index song.mp3;
}
}
Look into logs.
Seems like nginx tries to open paths like /srv/static/content/static/content/file.mp3
You need to rewrite url here, try this:
rewrite /static/content/(.*) /$1 break;