Nginx Plugin Vhost Website auf Port 80 in einem Unterordner installieren

    • OMV 4.x

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Nginx Plugin Vhost Website auf Port 80 in einem Unterordner installieren

      Hallo Openmediavault Community,

      Ich habe Nextcloud auf einem Vhost auf meinem NAS Server mit OMV 4 installiert. Momentan läuft die Website auf dem Nginx Vhost auf Port 81 und dem SSL Port 444 und das Openmediavault Webinterface auf port 80 und dem SSL Port 443. Wie kann ich die Website so umstellen, dass ich sie wie folgt aufrufen kann und das sie mit auf port 80 und 443 läuft:

      https://<meine-domain>/nextcloud

      Danke im voraus und Frohe Weihnachten.
    • Hallo,

      ich stehe vor dem selben Problem und finde keine Lösung. Hast du das inzwischen hinbekommen?

      In Verbindung mit einem anderen Port habe ich es hinbekommen, aber leider nicht mit den Standardports. Also https://<meine-domain>:8080/nextcloud geht, mein Wunsch wäre aber auf den Port verzichten zu können.

      Viele Grüße.
    • You need an nginx proxy setup. There are a few threads about this on the forum.
      omv 4.1.12 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.11
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • Thanks for the link.

      So for every service I'd add in that way I'd also have to add a DNS entry, is that correct?


      Would it also be possible to get something like

      Shell-Script

      1. location /part-db/ {
      2. alias /srv/dev-disk-by-label-vol1/www/part-db/;
      3. fastcgi_index index.php;
      4. }
      to work? This way no DNS entries would have to be added.


      With the above I see

      Shell-Script

      1. 018/01/02 09:52:13 [error] 6571#6571: *1 open() "/srv/dev-disk-by-label-vol1/www/part-db/css/omv.css" failed (2: No such file or directory), client: 192.168.144.235, server: openmediavault-webgui, request: "GET /part-db/css/omv.css HTTP/1.1", host: "nas.home.", referrer: "http://nas.home./part-db/"
      in the errorlog (/var/log/nginx/openmediavault-webgui_error.log). This makes sense, as there is no file omv.css anywhere on my system. But what goes wrong here?


      It works with the following server config

      Shell-Script

      1. server {
      2. listen 8080;
      3. listen [::]:8080;
      4. server_name nas.home.;
      5. set $root_path "/srv/dev-disk-by-label-vol1/www";
      6. root $root_path;
      7. index index.html index.php;
      8. set $socket "unix:/var/run/fpm-f5e655f9-218f-4d18-b9fe-0be6e86a63bd.sock";
      9. location ~ \.php(?:$|/) {
      10. include snippets/fastcgi-php.conf;
      11. fastcgi_pass $socket;
      12. }
      13. access_log /var/log/nginx/b62e7238-8b64-4c25-a486-5712af496cdf-access.log;
      14. error_log /var/log/nginx/b62e7238-8b64-4c25-a486-5712af496cdf-error.log;
      15. large_client_header_buffers 4 8k;
      16. }
      Display All
      when I open nas.home.:8080/part-db
    • I have a version which works at least for the php files:

      Source Code

      1. location /part-db {
      2. alias /srv/dev-disk-by-label-vol1/www/part-db;
      3. index index.php;
      4. try_files $uri $uri/ index.php;
      5. location ~ \.php(?:$|/) {
      6. include fastcgi.conf;
      7. fastcgi_index index.php;
      8. fastcgi_param SCRIPT_FILENAME $request_filename;
      9. fastcgi_pass unix:/var/run/php-fpm-openmediavault-mysql.sock;
      10. }
      11. }
      Display All

      It's based on /etc/nginx/openmediavault-webgui.d/openmediavault-mysql-management-site.conf, but unfortunately it doesn't work with css and js files that are located in the according subfolders. It still searches those in /var/www/openmediavault/js instead of /srv/dev-disk-by-label-vol1/www/part-db/js.

      How could I fix this?
    • Here's another update as it works now:

      Assuming that your custom PHP services shall go to /srv/dev-disk-by-label-vol1/www.

      Make two additional folders according to the Nginx style: /srv/dev-disk-by-label-vol1/www/sites-available and /srv/dev-disk-by-label-vol1/www/sites-enabled.
      Create configs in /srv/dev-disk-by-label-vol1/www/sites-available.
      Make a symlink to /srv/dev-disk-by-label-vol1/www/sites-enabled to enable a service.
      That's like the common Nginx mechanism, but in custom folders.

      A single config in /srv/dev-disk-by-label-vol1/www/sites-available may look like this

      Source Code

      1. location /part-db {
      2. root /srv/dev-disk-by-label-vol1/www;
      3. index index.php;
      4. try_files $uri $uri/ index.php;
      5. location ~ \.php(?:$|/) {
      6. include fastcgi.conf;
      7. fastcgi_index index.php;
      8. fastcgi_param SCRIPT_FILENAME $request_filename;
      9. fastcgi_pass unix:/var/run/php-fpm-openmediavault-mysql.sock;
      10. }
      11. }
      Display All
      But another sock should be taken, I think.

      To load the additional configurations /srv/dev-disk-by-label-vol1/www/sites-enabled must be included in the OMV Nginx server configuration (/etc/nginx/sites-enabled/openmediavault-webgui) like this:

      Source Code

      1. server {
      2. # stock configuration here
      3. include /srv/dev-disk-by-label-vol1/www/sites-enabled/*;
      4. }
      This is also the main drawback of this method: this last line has to be manually added after each update of the OMV Nginx plugin. If you don't use the plugin this shouldn't be a problem.

      Now you can open the OMV webinterface with omv.local in the browser and the service with omv.local/part-db. No more need to add DNS entries or work with different ports.


      EDIT:
      To make the include persistent you have to edit /usr/share/openmediavault/mkconf/nginx.d/10webgui at about line 127:

      Source Code

      1. -b \
      2. -o " include ${OMV_NGINX_SITE_WEBGUI_INCLUDE_DIR}/*.conf;" -n \
      3. -o " include /srv/dev-disk-by-label-vol1/www/sites-enabled/*;" -n \
      4. -o "}" \
      Add line 127 here.

      The post was edited 5 times, last by myscha ().

    • Instead of adding -o " include /srv/dev-disk-by-label-vol1/www/sites-enabled/*;" -n \ to /usr/share/openmediavault/mkconf/nginx.d/10webgui a less invasive solution is to create a new file in /etc/nginx/openmediavault-webgui.d/ and add the include there.

      Something like

      Shell-Script

      1. echo "include /srv/dev-disk-by-label-vol1/www/sites-enabled/*;" > /etc/nginx/openmediavault-webgui.d/zzz-custom.conf