NIGNX

Nginx is a caching server, and it can be used as a reverse proxy and it is s powerful, matter of fact, did you know amazon cloud front use nginx??

sudo apt install nginx

Turn Nginx into a reverse proxy

sudoedit /etc/nginx/sites-available/default

inside location curly braces:

location / {
    proxy_pass 
    http://site2.homelab.lan:8080
    ;
    #….more config
}

how to pass proxy information to backend

for security purposes or marketing information, backend servers dosen’t know about client or end users, because they are hitting the nginx reverse proxy and for that we’ll use some special config

in /etc/nginx/conf.d

create a file with any name you want and add this ( this is for centos )

If you are in ubuntu you can crate your .conf file inside sites-available then make a symlink to sites-enabled

[root@k8s-manager nginx]# cat ./conf.d/reverse-proxy.conf

server {
    listen 80;
    server_name centos.homelab.lan;

    location / {
        proxy_pass <https://dev.to/taqiyeddinedj>;
        #proxy_set_header Host $host;
        #proxy_set_header X-Real-IP $remote_addr;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Last updated