Nginx reverse proxy - no GUI

Started by Singman, October 19, 2024, 02:20:05 PM

Previous topic - Next topic
Hi,

I have 2 web servers on my LAN, they should dispatched by a classic Nginx setup like :

server {
    listen 80;
    server_name web1.domain.eu;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://<host1>:80;
    }
}

server {
    listen 80;
    server_name web2.domain.eu;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://<host2>:80;
    }
}


How to included that config on OPNSense Nginx configuration ? How to preserve it when the module will be updated ? There is no GUI for that kind of rules in web interface.

hi
try to use opnsense_stream_vhost_plugins folder for the file with your custom config
https://github.com/opnsense/plugins/blob/3c5e2b9d771bf8e7145eb659f1d8a4302640cc62/www/nginx/src/opnsense/service/templates/OPNsense/Nginx/http.conf#L69C1-L69C18

Thanks, i will make some tests with that.