OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: Singman on October 19, 2024, 02:20:05 PM

Title: Nginx reverse proxy - no GUI
Post by: Singman on October 19, 2024, 02:20:05 PM
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.
Title: Re: Nginx reverse proxy - no GUI
Post by: Fright on October 20, 2024, 12:12:36 PM
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
Title: Re: Nginx reverse proxy - no GUI
Post by: Singman on October 20, 2024, 02:18:08 PM
Thanks, i will make some tests with that.