Nginx and Web Services

Hi all

I have been planning on putting my website and a couple of other services behind Nginx as not to expose things directly to the internet.

So, I stood up a VM of Nginx. Got it installed and enabled with SSL. I changed the firewall ports from my webserver to Nginx and tested to make sure it was reachable from the outside - which it is.
This is where I think I have gone wrong.

I managed to get a web service through Nginx which would be on different ports without exposing it through my firewall so 443 only but browsing to the port works. That bit works fine and I’m happy with that.
I had to change some stuff in the config file for Nginx to get my website working. This is what I changed: Parts in Italic is what I added to the config. I also commented out some stuff in there too.

I had to add the proxy_pass command in the above config file which got my site working through NGinx. It was purely guessing that, that’s what I needed to do to get it working. I guess what I want to know is, is there an easier way? is what I have done correct or not? I mean it works, but I don’t know whether it’s supposed to be done that way - I feel like I’ve hacked away at the config to get it working.

Originally, when I did not add those proxy_pass directives, I would either get the Nginx Welcome page… or if I had not got the directives in the correct place my site would only half load.

I managed to get this bit working and have confirmed that it does:


server {
listen 443;
listen [::]:443;


location / {
proxy_pass https://x.x.9.39:9443;