Reputation: 3975
I have a serverpilot configured cloud server. I created a new app inside that and set up a tomcat listening to 8080. I am able to access that tomcat if I use domain name:8080. Now I want to modify the nginx reverse proxy to make it work at port 80.
File I tried modifying:
/etc/nginx-sp/vhosts.d/wfm.d/main.conf
Existing code
location /{
proxy_pass $backend_protocol://$backend_host:$backend_port;
}
New one I added:
location /{
proxy_pass http://127.0.0.1/wfm:8080;
}
I restarted my nginx after that but it doesn't work and the browser page keeps loading and finally timesout.
Upvotes: 0
Views: 188
Reputation: 431
The way to send requests to non-PHP apps with ServerPilot is not to make any customizations to Nginx but instead to use a .htaccess file to proxy requests to the port your app is listening on.
Your .htaccess file will look like this:
RewriteRule index.html http://localhost:8080/ [P]
RewriteRule (.*) http://localhost:8080/$1 [P]
Upvotes: 1