0

I have the following nginx configuration

rewrite_log on;
server {
 server_name greymarmita.no-ip.org;
 listen 80;
 rewrite ^(.*) https://$host$1 permanent;
}
server {
 server_name greymarmita.no-ip.org;
 listen 443 ssl;
 error_log /var/log/nginx/main.error;
 access_log /var/log/nginx/main.access;
 ssl on;
 ssl_certificate /etc/ssl/localcerts/autosigned.crt;
 ssl_certificate_key /etc/ssl/localcerts/autosigned.key;
 root /srv/www;
 index index.html /index.html;

 location /rasp/ {
   proxy_pass http://192.168.2.6:81/;
  }
 location /cam/ {
   proxy_pass http://192.168.2.4:8081;
 }
 location ^~ /router/ {
   proxy_pass http://192.168.2.1/;
 }


location /nas/ {
  proxy_pass http://192.168.2.13/;
  proxy_redirect    off;
  proxy_set_header  Host            $host;
  proxy_set_header  X-Real-IP       $remote_addr;
  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
}

}

However when I try to access http://192.168.2.6/nas although the html files are served correctly, files under /web/ are not

GET https://greymarmita.no-ip.org/web/images/login.png 404 (Not Found)

The correct path for these assets should be https://greymarmita.no-ip.org/nas/web/images/login.png

Jonathan
  • 297
  • 1
  • 3
  • 17

1 Answers1

0

You don't have a location to match that file, try adding this

location / {
  try_files $uri $uri/;
}
Mohammad AbuShady
  • 40,884
  • 11
  • 78
  • 89
  • do you have the `root` pointing to the right folder? also did you restart nginx? and is `/web` an actual folder, or is it supposed to be passed too? – Mohammad AbuShady Feb 13 '15 at 21:42
  • yes, restarted nginx, changed root to point to an actual folder. /web is a real folder under http://192.168.2.13/ If I try to access https://192.168.2.6/nas/web/css/style.css?v20 I get a 200 OK – Jonathan Feb 13 '15 at 21:48