Changing OMV Default Behavior: NGinx Configuration

  • I'm current running OMV 2.1.23 with the docker plugin. I have been trying to get a Docker container to run on an alternate IP Address on the OMV server but on port 80. For the curious, I'm working with clue/ttrss to bring my feed reader back online.


    I keep hitting my head against a brick wall because the default OMV configuration for NGinx is to answer on port 80 on any and all interfaces on the server with the OMV webgui.


    However, I believe I have a solution. In the file /etc/nginx/sites-available/openmediavault-webgui there is a line:

    Code
    listen [::]:80 default_server ipv6only=off;


    Can we have this line changed to this:

    Code
    listen 80 default_server;
     listen [::]:80 ipv6only=on;


    In my testing (which is only IPv4 based granted), the configurations seem to have similar default results - the OMV webgui runs on all 80 and 443 ports. However, if you create a new virtual interface and enable *a second* nginx server like this:


    Code
    root@NAS:~# ifconfig eth0
     eth0      Link encap:Ethernet  HWaddr 00:1f:29:0b:80:14
     inet addr:192.168.2.3  Bcast:192.168.2.255  Mask:255.255.255.0
    
    ...
    
    
     root@NAS:~# ifconfig eth0:1 192.168.2.5
     root@NAS:~# touch /etc/nginx/sites-available/ttrss
     root@NAS:~# ln -s /etc/nginx/sites-available/ttrss /etc/nginx/sites-enabled/ttrss


    Then edit the ttrss file to contain the following NGinx Reverse Proxy setting:



    ...then restart nginx...


    Code
    root@NAS:~# service restart nginx


    You will find that all traffic on port 80 on the alternate IP Address of 192.168.2.5 (not the main OMV server address) is passed through from NGinx to my Docker container running on 192.168.2.5:8080. The reverse proxy configuration is required in NGinx because we are not altering the OMV base files to make NGinx only listen on a specific IP Address - the system is still configured to list on all available IP Addresses on ports 80/443 unless otherwise told by the ttrss available site.


    If you try the reverse proxy *without* this change in the openmediavault-webgui, you get errors:


    Code
    root@NAS:~# service nginx restart
    Restarting nginx: nginx: [emerg] bind() to 192.168.2.5:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 192.168.2.5:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 192.168.2.5:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 192.168.2.5:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 192.168.2.5:80 failed (98: Address already in use)
    nginx: [emerg] still could not bind()
    nginx.


    I believe the change in NGinx configuration is still in the spirit of what the feature is supposed to be - but this configuration would allow users to use secondary NGinx Reverse Proxy sites to point to whatever they chose without customizing base OMV file.


    Could we get this change to opernmediavault-webgui introduced in the next version of OMV?


    Thanks!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!