OMV5 + Docker + NGINX

With OMV5 it seems some plugins have been depricated in favor of hosting them on a local Docker instance. Docker and Portainer are easily installed on OMV using omv-extras.org. The next step is to configure a reverse proxy so we can get rid of ports in the address and access our containers via omv-nas.local/portainer instead of omv-nas.local:9000.

Normally I'd install linuxserver/letsencrypt to implement SSL and NGINX but I don't expose my NAS to the internet and OMV already uses NGINX. New sites and subdomains can be defined in /etc/nginx/sites-available but to define subfolders we'd have to edit the default site, which is not recommended as it will get overwritten by the OS at somepoint. If we actually look at the default site, /etc/nginx/sites-available/openmediavault-webgui, we'll see the following include, include /etc/nginx/openmediavault-webgui.d/*.conf;

Create a subdomain configuration via nano /etc/nginx/openmediavault-webgui.d/portainer.conf and copy the following:

location /portainer {
  return 301 $scheme://$host/portainer/;
}

location ~* ^/portainer(/.*)$ {
  proxy_http_version 1.1;
  proxy_set_header Connection "";
  rewrite /portainer(.*) $1 break;
  proxy_pass http://127.0.0.1:9000;
}

location ~* ^/portainer/(api/websocket/ws/.*)$ {
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_http_version 1.1;
  rewrite /portainer(.*) $1 break;
  proxy_pass http://127.0.0.1:9000;
}

After that make sure to run sudo systemctl restart nginx. That should be all, now you can access portainer via http://omv-nas.local/portainer. You can follow this pattern to subdomain any other apps you're hosting on the NAS.