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:


    Code
    location /service1 {
    		proxy_pass http://omv.host.name;
    		include /config/nginx/proxy.conf;
    	}

    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.

    Code
    location /omv/ {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto http;
          proxy_pass http://192.168.x.y/;
       }


    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.

    OpenMediaVault 7.0.4-2 (Sandworm) :thumbup:
    HARDWARE: Raspberry Pi 4 Model B Rev 1.2 | SYSTEM: Debian GNU/Linux 12 (bookworm) aarch64

    KERNEL: Linux 6.1.21-v8+ | PROCESSOR: BCM2835 (4) @ 1.500GHz | MEMORY: 4GB | STORAGE: MicroSD 60GB + HDD 6TB
    PLUGINS: nut, omvextrasorg, backup, compose, cputemp, flashmemory, kernel, remotemount, sharerootfs

    DOCKER: nginx proxy manager, pi-hole, wireguard, transmission

    Einmal editiert, zuletzt von 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 http://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.

    OpenMediaVault 7.0.4-2 (Sandworm) :thumbup:
    HARDWARE: Raspberry Pi 4 Model B Rev 1.2 | SYSTEM: Debian GNU/Linux 12 (bookworm) aarch64

    KERNEL: Linux 6.1.21-v8+ | PROCESSOR: BCM2835 (4) @ 1.500GHz | MEMORY: 4GB | STORAGE: MicroSD 60GB + HDD 6TB
    PLUGINS: nut, omvextrasorg, backup, compose, cputemp, flashmemory, kernel, remotemount, sharerootfs

    DOCKER: nginx proxy manager, pi-hole, wireguard, transmission

  • 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>http://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.

    OpenMediaVault 7.0.4-2 (Sandworm) :thumbup:
    HARDWARE: Raspberry Pi 4 Model B Rev 1.2 | SYSTEM: Debian GNU/Linux 12 (bookworm) aarch64

    KERNEL: Linux 6.1.21-v8+ | PROCESSOR: BCM2835 (4) @ 1.500GHz | MEMORY: 4GB | STORAGE: MicroSD 60GB + HDD 6TB
    PLUGINS: nut, omvextrasorg, backup, compose, cputemp, flashmemory, kernel, remotemount, sharerootfs

    DOCKER: nginx proxy manager, pi-hole, wireguard, transmission

  • 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?

Jetzt mitmachen!

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