Nginx Notes
Way back in https://macblaze.ca/?p=14445 I set up Nginx to handle port forwarding to my home computer. Since then I have modified it a bot and I wanted to make a not of those mods here.
Site in a subfolder
- I have the subdomain xxx.macblaze.ca.
- I want to have it access a site at 192.168.1.xx:8080
- in a folder /folder
Set up the subdomain as usual
- go to Custom Locations
- location
/ - Forward Hostname/IP
192.168.1.xx/folder - Forward Port
8080
Docker container
- ensure the container and Nginx’s container are on the same network. (current code method)
Set up the subdomain as usual
- go to Details
- Forward Hostname/IP
<container-name>(get usingdocker ps --format "{{.Names}}")
or Container IP - Forward Port
<the internal port>
Two Sites/Apps on one subdomain
- I have the subdomain xxx.macblaze.ca.
- I want to have it access a site at 192.168.1.xx1:8080
- I want the subdomain xxx.macblaze.ca/app to access an app at 192.168.1.xx2:8080
Set up
- the subdomain as usual for the site
- go to Advanced Locations
- Add:
location /app { proxy_pass http://192.168.1.xx2:8080/; } location /app/ { proxy_pass http://192.168.1.xx2:8080/; }