OMV Web UI Behind NGINX Config

    • OMV 3.x
    • OMV Web UI Behind NGINX Config

      So I've tried a lot of searching but unfortunately everything related to nginx on this site tends to be specifically related to setting up nginx plugin or the configs for gaining access to other plugins/containers running on OMV.

      What I'm looking to do is actually proxy the connection to the OMV Web Gui. I don't plan to actually make this externally accessible, but I'd like to add it to the list of services I can just reach at a single url, with multiple locations: server.local/service1, server.local/service2, etc, etc. Unfortunately, I'm not having any lucky with the basic of:

      Source Code

      1. location /service1 {
      2. proxy_pass http://omv.host.name;
      3. include /config/nginx/proxy.conf;
      4. }
      Unfortunately I'm just getting started with NGINX after all this time, and so I'm not quite familiar with all the options available, and how I can work through troubleshooting the connection to see what additional inputs I may need to this to make it function properly.
    • I saw your posting yesterday, and was curious whether it could be done. Today I tried it out on my server. Here are what I found:

      1, Add this directive to the NGINX config for your server.local, where 192.168.x.y is your OMV box IP address.

      Source Code

      1. location /omv/ {
      2. proxy_set_header X-Real-IP $remote_addr;
      3. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      4. proxy_set_header X-Forwarded-Proto http;
      5. proxy_pass http://192.168.x.y/;
      6. }

      2. You don't need to change the NGINX config on your OMV box. However, there are some codes, which use absolute paths, must be modified. I didn't do a thorough investigation, but found the file /usr/share/php/openmediavault/controlpanel/controlpanelabstract.inc has a few /extjs6/.... in it. Please open an editor and replace those "/extjs6" with "extjs6".

      3. Also for the file /var/www/openmediavault/css/theme-all.css, change "/images" to "../images". There may be some other modifications to be made.

      4. Restart your php5-fpm with "systemctl restart php5-fpm" and use your browser to check out server.local/omv.

      On my local server and OMV box, this setup seems to work fine. I can't be sure all the plugins will work with it though.
      1. OpenMediaVault 4.1.6 (Arrakis) :thumbup:
        HARDWARE: ZOTAC ZBOX CI323 Nano + Patriot Torch SSD 60GB + WD MyBook 1TB
        PROCESSOR: Intel(R) Celeron(R) N3150 1.6GHz
        SYSTEM: Debian Stretch (4.16.0-0.bpo.1-amd64)
        PLUGINS: nut, omvextrasorg, backup, transmissionbt, dnsmasq

      2. OpenMediaVault 4.1.3 (Arrakis) :thumbup:
        HARDWARE: Pogoplug Classic (POGO-E02) + SanDisk Cruzer Blade 16GB + Maxtor 160GB
        PROCESSOR: Feroceon 88FR131 rev 1 (v5l) 1.2GHz
        SYSTEM: Debian Stretch (4.10.9-kirkwood-tld-1 armv5tel)
        PLUGINS: nut, omvextrasorg, backup, downloader, dnsmasq

      The post was edited 1 time, last by kochin ().

    • Thanks for the input, though I'm not sure I'm seeing how this works. The problem is that OMV web UI doesn't expect /omv in your case in the URL. So I'm getting a 404 not found when I hit it. The other thing is that I'm not running it IN omv using the plugin, I'm actually using a docker container running nginx. So not sure how applicable this is or if there is something different when it's running locally.
    • Mine is a 2-machine setup. The main web server is in a virtual machine, and the OMV box is a physical machine. Of course, they can be both virtual or physical. When you type server.local/omv into the browser. The NGINX server on the server.local (main web server) will handle the request by matching the location /omv/, and pass the request to the OMV box (192.168.x.y) without the /omv/ part. To the OMV web server, it only see a request to 192.168.x.y and should handle it as usual (as long as no absolute paths used in the programs).

      I think running them in Docker environment is no different to running in real machines. You probably can do it by spinning up a NGINX container and a OMV container.
      1. OpenMediaVault 4.1.6 (Arrakis) :thumbup:
        HARDWARE: ZOTAC ZBOX CI323 Nano + Patriot Torch SSD 60GB + WD MyBook 1TB
        PROCESSOR: Intel(R) Celeron(R) N3150 1.6GHz
        SYSTEM: Debian Stretch (4.16.0-0.bpo.1-amd64)
        PLUGINS: nut, omvextrasorg, backup, transmissionbt, dnsmasq

      2. OpenMediaVault 4.1.3 (Arrakis) :thumbup:
        HARDWARE: Pogoplug Classic (POGO-E02) + SanDisk Cruzer Blade 16GB + Maxtor 160GB
        PROCESSOR: Feroceon 88FR131 rev 1 (v5l) 1.2GHz
        SYSTEM: Debian Stretch (4.10.9-kirkwood-tld-1 armv5tel)
        PLUGINS: nut, omvextrasorg, backup, downloader, dnsmasq

    • So I went through the nuances of digging into the nitty gritty detail of the trailing slash you seem to have. It's a mystery to me how many people use such different syntax yet all end up with working configs in the end. But in this scenario, no go. It turns out, my location directive was using <tt>/omv</tt> and for the proxy pass I was using <tt>serverIP;</tt>. The lack of simply adding in the trailing slashes was the reason it was not working. I'm not a web/proxy guru, so I'm not sure why in most my other scenarios that never mattered, but it absolutely did here.

      Once I did this, I was able to hit the server - albeit with no login prompt. I assume this is because I hadn't yet looked at modifying the other content you mentioned.

      Do you know are these files core files that may be updated with OMV updates? Or are they more side design/customization files that aren't likely to change? If they can change with any update - I might be hesitant to do this as it means another thing to keep track of.
    • When I first tried it after reconfigure the main Nginx server, I got a blank page. Then I inspected the page in browser, and found some URI's were coded with absolute paths. My quick investigation led me to identify and modify two files, controlpanelabstract.inc and theme-all.css. I was able to login and use OMV afterward.

      Yes, those files are part of the core program. They definitely may be replaced when updated unless we can catch @votdev's attention and convince him to roll those changes into the core program.
      1. OpenMediaVault 4.1.6 (Arrakis) :thumbup:
        HARDWARE: ZOTAC ZBOX CI323 Nano + Patriot Torch SSD 60GB + WD MyBook 1TB
        PROCESSOR: Intel(R) Celeron(R) N3150 1.6GHz
        SYSTEM: Debian Stretch (4.16.0-0.bpo.1-amd64)
        PLUGINS: nut, omvextrasorg, backup, transmissionbt, dnsmasq

      2. OpenMediaVault 4.1.3 (Arrakis) :thumbup:
        HARDWARE: Pogoplug Classic (POGO-E02) + SanDisk Cruzer Blade 16GB + Maxtor 160GB
        PROCESSOR: Feroceon 88FR131 rev 1 (v5l) 1.2GHz
        SYSTEM: Debian Stretch (4.10.9-kirkwood-tld-1 armv5tel)
        PLUGINS: nut, omvextrasorg, backup, downloader, dnsmasq

    • Gotcha, makes sense. As I expected I think anyhow. I've noticed a few wonky things trying to go through the proxy. The main oddity, it seems the header logo for some reason doesn't want to load. Not major. Bigger issue is one of the plugins I use extensively - DockerGUI - problems with container start, stop, restart calls. I'll prob have to do as you did and debug to find where the hard links are and look at possible updates or live with what I can. Thanks for the help, glad I could at least get it functional.

      +1 for Votdev adding the changes. Is the code available on github to submit PR's? Maybe we just put a basic PR in for the changes you've found?