How to Setup a Reverse Proxy on Home Network

preview_player
Показать описание

We will be using NGINX as our reverse proxy and we will be configuring it to proxy our requests for UNMS, Unifi Controller, Plexpy (Tautulli), and Pihole. For this to work, you need to have local DNS already configured. I have a video on how to set this up using Pihole on a Raspberry Pi.

Timestamps:
Drawing it out: 1:34
Installing NGINX: 6:08
Beginning Configuration: 8:30
Generating Certificates: 17:20
Updating DNS Records: 20:50
Verifying Everything Works: 22:56
Troubleshooting: 24:12
Rambling Outro: 25:09

Below are some of the configurations and commands I use in the video. Just modify them to suit your needs.

# Regular port 80 proxy.

server{
listen 80;

location / {
}
}

# Port 80 redirect to 443

server{
listen 80;

location / {
}
}

# Port 443 proxy using SSL (Used for UNMS or similar)

server{
listen 443 ssl http2;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;

location / {
}
}

# Port 443 proxy using SSL and header modification (Used for Unifi Controller

server{
listen 443 ssl http2;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
location /wss {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
}

# Ubuntu command to generate certificates and create SSL directory

sudo mkdir /etc/nginx/ssl/

# Ubuntu command if restarting NGINX fails due to .PID file missing.

printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" | \
sudo systemctl daemon-reload
sudo systemctl restart nginx
Рекомендации по теме
Комментарии
Автор

Glad I randomly found this video. Probably the best tutorial I’ve seen all month and believe me I’ve watched too many to try to get everything running. Cheers.

devious_mud
Автор

OMG!!! This video is SOLID-EFFING-GOLD!! I have literally watched 100 other videos that were c-r-a-p examples....this is the first one that actually worked! and did not make me feel stupid for not understanding this stuff....awesome work Toasty!!!!

riddockc
Автор

I am surprised to see that how complete your video is even you mentioned that you don't know much of the configs. They all fit nicely in the flow and are very understandable. Great job.

jawadhasan
Автор

Your video is a great contribution to all of us who need these computer tools, but we are not programmers or coders. Very clear and explanatory within a simple and informative language. I encourage you to make another video (as a second part) for the use of the reverse proxy for other services or servers, along with the use of SSL Let’s Encrypt certificates. Thanks a lot.

RaulVieira
Автор

Wow this actually helped me resolve my issue. Thank you for explaining this in simple terms.

merlingt
Автор

Thank you for this! Great walkthrough/tutorial in a step-by-step way.

AndreasBodin
Автор

Nice job explaining in layman's terms, I appreciate the work you put into this. No need to really explain the inner workings it is good for them to research it on their own to learn. Again Good Job on the video, thanks.

michaelcooper
Автор

The best tutorial in this topic I've seen

electrotsmishar
Автор

thnQ thnQ thnQ thnQ. finally, someone can speak detailes

str
Автор

When 4:28 hits I was like this guy is dope sounding like a sys admin

zacbolick
Автор

Every thing is well explained. For Font size to be visible I had to use bootaddam

itprof
Автор

Awesome tutorial. But for me I would separate config file based on the host you want to connect, that way if I messed up the config it will not affect the other host. Also, always use sudo nginx -t to test configuration before actually apply the config. And finally, I would always do sudo nginx -s reload to load the configuration without having to restart the service

alexmason
Автор

why you not do it in unraid! darn would have loved that

Ender_Wiggin
Автор

Hi! Im recently getting into nginx, found out that nginx supported reverse proxy so im now giving it a try

Thanks so much for this video, everything is so useful and easy to understand

If i may clarify, so if i understood correct, the "server_name" key in the config file doesnt define a domain server name, but essentially tells the nginx server that "this server block is for the specified server address"

But the domain name itself still has to be defined in a dns server like pihole because nginx itself doesnt define any domain names right?

uuu
Автор

Thank you for the video @Toasty_answers,
Are you using different devices/servers for each application (UNMS, Unifi)? I see different IP addresses for UNMS and Unifi...
can they be installed in the same server and just use different ports ?

pedrogmiller
Автор

Thank you for the information brother but I'm facing a small issue that only js and CSS is not loading in my reverse proxy. It would be a great help if you can help me.

ShivkantBaghel
Автор

Sir Can Guide Me How To Setup Reverse Proxy On Server-B With Nginx And Redirect To Server-A

I Am Currently Doing That Via aaPanel But Its Not Stable.

Please Guide Me With Another Way.

Thanks

Автор

Hi, I have an Asus router running ddwrt on wifi client mode attached to a router that I do not have access to the port forwarding settings. I'm trying to get openvpn to connect to the external ip but, I don't have the ability to port forward on the other router which is the isp modem/router arris cable modem becuase, I don't own the the Arris modem. Can a reverse proxy be the solution to this problem? If it isn't can you point me in the right direction?

jonathankeenan
Автор

do you need to have those domains name after ""server_name" created like in a DNS server or are you just creating them in the nginx config file?

xXsomberXx
Автор

Where is mentions documents root path
I have to node

gamimayur