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 6.0.5-2 Shaitan | 64 bit | 5.13 proxmox kernel | omvextrasorg 6.0.4 | kvm plugin 6.0
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Could you please be more specific or provide a link to one of those threads? The threads I found seem to be about other problems.

  • 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

    Bash
    location /part-db/ {
    alias /srv/dev-disk-by-label-vol1/www/part-db/;
    fastcgi_index index.php;
    }

    to work? This way no DNS entries would have to be added.



    With the above I see

    Bash
    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

    when I open http://nas.home.:8080/part-db

  • I have a version which works at least for the php files:


    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

    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:

    Code
    server {
    # stock configuration here
    include /srv/dev-disk-by-label-vol1/www/sites-enabled/*;
    }

    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:

    Code
    -b \
    -o " include ${OMV_NGINX_SITE_WEBGUI_INCLUDE_DIR}/*.conf;" -n \
    -o " include /srv/dev-disk-by-label-vol1/www/sites-enabled/*;" -n \
    -o "}" \

    Add line 127 here.

  • 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

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

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!