Reverse Proxy Issue with Nginx

Posted October 21, 2021 129 views

I have hosted a Flask app using gunicorn on a port on my VM IP address. The app is accessible via http://ip_address:port. Now I want to access via a subdomain. I have the A record to redirect the subdomain and domain to the vm public IP.

I have installed nginx and it is perfectly hosting the default nginx page on when accessed via IP address but it giving an error ERRCONNECTIONREFUSED when trying to access via IP address.

Can anyone point me to the right direction as to how I can resolve this error?Further, how can I redirect/reverse proxy the subdomain to ipaddress:port where my actual app is hosted with an SSL

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


Keep in mind that once you make your DNS change it might take up to 24 hours for the DNS cache to clear over the Globe before you could see the new records.

Can you share the Nginx server block that you are using here?

Also, here is a quick demo on how to do this with Docker, in your case it would be quite similar, but with your specific backend service:

Hope that this helps.