Previously (about 5months ago) everything was working well, right now, instead of @app index.html is served.
Same problem on nginx version: 1.6.2 and 1.8
This is my /etc/nginx.conf
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
root /opt/app/server/html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
}
include /etc/nginx/conf.d/*.conf;
}
This is my /etc/nginx/conf.d/user_example.conf
server {
listen 80;
server_name user.example.com;
root /home/user/webapps/;
location / {
try_files $uri $uri/ @app; (removed index.html;)
}
location @app {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:9000;
}
}
Could someone explain me why @app is skipped?
Hm this could be another question, but ...
If i remove /home/user/webapps/index.html
and go to user.example.com
I get 403 Forbidden
. And i want to 'execute' proxy_pass from @app, what i need to change?
Changed config - but still would like to know how to use that named location.
server {
listen 80;
server_name user.example.com;
root /home/user/webapps/;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:9000;
}
}
Problem was not the named location @app
but $uri/
wrong permissions over directory /home/user/webapps
. Problem solved.