Nginx; Where to Start?

ptmuldoon

Well-Known Member
Apr 28, 2012
36
2
48
I run a little HomeLab setup using Proxmox as my baremetal, with a couple of Containers and VM's running. Also in reading things, I started experimenting with Docker's by setting up Proxmox VM with Alpine Linux, with the dockers inside that VM.

Now I'm trying to learn and understand more about Nginx and setting up a reverse proxy so that I can access things from outside my home better without having to rely on a VPN connection.

My basic understanding (and please correct me if I am wrong) of Nginx is.

All incoming web traffic on port 80 gets directed to your Nginx server. So I would need to port forward on router port 80 to the Nginx container or VM.
Nginx will then look at the url of that request and then direct it to the correct VM or container IP address?

so if I have subdomain1.myipaddress.com. Then Nginx would route that to the correct VM/container/docker?
And then similar for subdomain2.myaddress.com

Assuming I understand that correctly. I do see their is a turnkey template for Nginx. Would it best to use that in a Container? I also now have the docker running under Alpine Linux. So I could also install an Nginx docker. But think that would possibly be making it more complex than is necessary?

Am I on the right track?
 
hi,

it seems you misunderstood.

nginx is a webserver. the point of setting up a reverse proxy is to be able to access the PVE GUI without having to specify port 8006.

so that I can access things from outside my home better without having to rely on a VPN connection.

for this, you need to set up port forwarding.

for example if you have an SSH server running on one of the containers, and you want to access that from outside:

internet -> PVE port X -> VM/CT port Y

so for example you could forward port 2222 on your PVE machine to the container:

internet -> PVE port 2222 -> VM/CT port 22

that would open port 2222 on your PVE IP, and forward that port to the VM/CT's ssh port. that way you can ssh in to your VM without a VPN connection.


these are two different things (nginx reverse proxy & port forwarding). they can also be used in conjunction (maybe that's what you're looking for?)

in any case i suggest you read the following wiki pages for some information [0] [1]

[0]: https://pve.proxmox.com/wiki/Web_Interface_Via_Nginx_Proxy
[1]: https://pve.proxmox.com/wiki/Networ...ith_tt_span_class_monospaced_iptables_span_tt
 
hi,

it seems you misunderstood.

nginx is a webserver. the point of setting up a reverse proxy is to be able to access the PVE GUI without having to specify port 8006.
He understood correctly, you are thinking in terms of PVE's interface, he in terms of other webservers?
 
I run a little HomeLab setup using Proxmox as my baremetal, with a couple of Containers and VM's running. Also in reading things, I started experimenting with Docker's by setting up Proxmox VM with Alpine Linux, with the dockers inside that VM.

Now I'm trying to learn and understand more about Nginx and setting up a reverse proxy so that I can access things from outside my home better without having to rely on a VPN connection.

My basic understanding (and please correct me if I am wrong) of Nginx is.

All incoming web traffic on port 80 gets directed to your Nginx server. So I would need to port forward on router port 80 to the Nginx container or VM.
Nginx will then look at the url of that request and then direct it to the correct VM or container IP address?

so if I have subdomain1.myipaddress.com. Then Nginx would route that to the correct VM/container/docker?
And then similar for subdomain2.myaddress.com

Assuming I understand that correctly.

Setup as a reverse proxy, that is correct. I'd actually advise you to consider Caddy Server as it's easier than Nginx in several cases, and then also does the LetsEncrypt auto certificate update/installations.

I do see their is a turnkey template for Nginx. Would it best to use that in a Container? I also now have the docker running under Alpine Linux. So I could also install an Nginx docker. But think that would possibly be making it more complex than is necessary?

Am I on the right track?

My advice: get the simplest Debian container going, install Caddy server (It's simple and you can test things in a simple cli line)

If you are insistent on NGinx for the WAF etc, again I'll advice to start with the simplest Debian container/VM, and expand from there. the Dockers/templates for NGInx are making the assumptions you are already understanding the NGinx ins and outs,
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!