Hello,
I am using Nginx web server and getting error “502 bad gateway” while accessing some sites.
I have observed that, proxy_pass port is not listing in the server.
e.g.:- In above configuration example.com is running on port 80 and proxy_pass localhost is running on port 8009.
Port 80 is listing perfectly but port 8009 is not listing because of this reason example.com is not working. Please suggest me on this.
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:8009;
send_timeout 6000;
proxy_read_timeout 120;
proxy_connect_timeout 120;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
}
Thanks,
Imran Khan.