I am using JBOSS Application Server on which our main project runs. On the top we are using nginx as webserver to listen on port 80 which act as proxy for forwarding all connections to 8080 port on which jboss project is running. Below is the configuration we added. Now the first page work fine using url http://domain_name which is the login page. But after we login the page redirect to next page and get appended with project name twice and hence throws error since it couldn’t find the page in that path. How to rewrite the url which will remove project name for users using nginx? I know we can use this project as default by changing context root tag in the web.xml other than that is there anything we can do.
Nginx Configuration
location / {
proxy_pass http://localhost:8080/project1/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy-set_header Host $host;
}
Error
HTTP Status 404 - /project1/project1/
type Status report
message /project1/project1/
description The requested resource (/project1/project1/) is not available.
Just use
proxy_pass http://localhost:8080;That is, remove
project1from the proxy pass directive.To have users only enter
http://domain.comand nothttp://domain.com/project_name, you need to use the root directive in nginx.root /server/path/to/domain.com/project_name;Your other server should be set with the equivalent directive. With Apache, this is the DocumentRoot directive.