Nginx配置文件仅适用于''/&引用;

Nginx配置文件仅适用于''/&引用;,nginx,Nginx,我将nginx设置为一种静态文件服务器。出于某种原因,它只有在我转到123.123.123.123/或123.123.123.123时才起作用。但是,当我转到123.123.123.123/static/content/或123.123.123.123/static/content/other.mp3时,它返回一个404 not found。以下是位于/etc/nginx/sites available中并链接到/etc/nginx/sites enabled的配置文件。我真的不明白为什么它不起

我将nginx设置为一种静态文件服务器。出于某种原因,它只有在我转到123.123.123.123/或123.123.123.123时才起作用。但是,当我转到123.123.123.123/static/content/或123.123.123.123/static/content/other.mp3时,它返回一个404 not found。以下是位于
/etc/nginx/sites available
中并链接到
/etc/nginx/sites enabled
的配置文件。我真的不明白为什么它不起作用

如有任何指示或提示,将不胜感激

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; } } 服务器{ 听123.123.123.123:80; 服务器名称“”; 地点/{ root/srv/主页; index.html; } 位置/静态/内容/{ root/srv/static/content; 索引song.mp3; } } 查看日志。 nginx似乎试图打开/srv/static/content/static/content/content/file.mp3这样的路径 您需要在此处重写url,请尝试以下操作:


重写/静态/内容/(*)/$1中断

如果我的应用程序中有很多链接/静态页面?我是否需要为它们中的每一个重写url?