I have already tried suggestions mentioned in:
Hide port in Nginx reverse proxy redirection
but it does not help me.
I have done nginx reverse proxy for my django+gunicorn application and it is open on port 8000. I can access a machine name as http://some_machine:8000 to see my app running. I have mapped localhost running on that machine with machine name using Nginx reverse proxy. I want to hide the port and in url would like something like http://some_machine/zmk instead of http://some_machine:8000/zmk.
I am writing the below content to my /etc/nginx/conf.d
folder:
upstream zms {
ip_hash;
server zms:8000;
}
# portal
server {
location /zmk {
proxy_pass http://zms/;
# proxy_redirect http://some-machine:8000/ http://some-machine/zmk;
port_in_redirect off;
# autoindex on;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
listen 8000;
server_name localhost
server_name_in_redirect off;
}
I am not understanding what am I doing wrong? I have also tried copying the above content to /etc/nginx/site-available
folder.