This question may be asked many times, I have been reading but still can't get what I want.
I have an application running in http://172.17.1.10:8080/myapp
I would like to setup nginx reverse proxy accessing the application using http://sub.domain.com
only , hidding "myapp" in the address bar.
My current setting is:
server{
listen 80;
server_name sub.domain.com;
location /myapp {
rewrite ^/myapp(.*) /$1 break;
proxy_pass http://172.17.1.10:8080;
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;
include /etc/nginx/proxy_params;
}
}
But I keep viewing the Nginx index page with http://sub.domain.com
, and http://sub.domain.com/myapp
the tomcat index page. What am I missing?