On Fri, May 10, 2019 at 07:57:14AM -0400, cox123456a wrote: Hi there,
> When I click to change the module (from admin to analytics, for example), > I'm loosing the port number: > http://170.180.190.200:8000/admin => http://170.180.190.200/analytics (Page > breaks as the port is missing) You can check the nginx logs to be sure; but what I suspect is happening is that when you change to analytics, your browser makes a request for http://170.180.190.200:8000/analytics, which gets a redirect to http://170.180.190.200/analytics/. And the second one is the one that fails for you, because you want it to keep the port from the Host: header in the http redirection from nginx. If that is the case... > How can I configure NGINX to forcelly add the port number when I change the > module? I think that you cannot easily. When nginx generates a http redirection, it can use the hostname from the Host: header, and it can use the port that the request came to nginx on; but it cannot (I think) use the port that was listed in the Host: header. One possible way, which may or may not be useful in your case, would be to change your nginx so that it listens on both port 80 and 8000; and change your port forwarding so that [external] port 8000 is sent to [nginx] port 8000 (instead of to the current [nginx] port 80). With that config, then I think that internal things that talk to port 80 will continue to talk to port 80; while external things that talk to port 8000, will have their redirects-from-nginx directed to port 8000 (because they are now talking to nginx-port-8000). That is, in nginx, where you have > server { > listen 80 default_server; add an extra line > listen 8000 default_server; and change this: > My router configuration (page 8000 to 80): > > https://unix.stackexchange.com/questions/518085/accessing-nginx-behind-a-virtual-server-looses-port-number/518183?noredirect=1#5181833 to go to port 8000 instead of port 80. Untested by me, but it looks like it should work. Good luck testing it! f -- Francis Daly fran...@daoine.org _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx