Reverse Proxy Issue with Nginx

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 ERR_CONNECTION_REFUSED 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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.


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. Best, Bobby