NGINX Reverse proxy + vitual hosts

    • OMV 3.x

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

    • NGINX Reverse proxy + vitual hosts

      Hi!
      I'm going to set up my Nextcloud and thinking if I should set up nginx with the plugin or the normal way (manual creating conf files).

      I'm not sure, if it will work setting up a reverse proxy just with the plugin. Does anybody tried it? My intention would be by just using the WebGui and not ssh setting it up.
      Or am I the first one trying?
    • I give you wrong information
      omv-nginx support reverse proxy
      it is very simple and easy
      just install omv-nginx and

      set Name-based -> set server name whatever you want

      putting Extra options

      location ^~ / {
      proxy_pass localhost:<next cloud port>;
      proxy_http_version 1.1;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_read_timeout 1d;
      }
      OMV3 on Proxmox
      Intel E3-1245 v5 | 32GB ECC RAM | 4x3TB RAID10 HDD
      omv-zfs | omv-nginx | omv-letsencrypt | omv-openvpn
      Click link for more details
    • luxflow wrote:

      I give you wrong information
      omv-nginx support reverse proxy
      it is very simple and easy
      just install omv-nginx and

      set Name-based -> set server name whatever you want

      putting Extra options

      location ^~ / {
      proxy_pass localhost:<next cloud port>;
      proxy_http_version 1.1;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_read_timeout 1d;
      }
      Where can I set Name-based Servername ?
      Where to put the Extra options?
      Did not find any settings in OVM webgui for nginx.
      Do I have to edit the nginx.conf?

      Regards
      Erich
    • erichabg wrote:

      Where can I set Name-based Servername ?Where to put the Extra options?
      Did not find any settings in OVM webgui for nginx.
      Do I have to edit the nginx.conf?

      Regards
      Erich
      Quick solution to your question - note that you don't need the nginx plugin for this!

      Using Nextcloud as an example:
      Create /etc/nginx/openmediavault-webgui.d/nextcloud.conf with the content below. Make changes to the file name, nextcloud and http://localhost:port/ to suit your needs. This example would allow you to access Nextcloud via yourdomain/nextcloud.

      Source Code

      1. location ^~ /nextcloud/ {
      2. proxy_pass http://localhost:port/;
      3. proxy_set_header Host $host;
      4. proxy_set_header X-Real-IP $remote_addr;
      5. proxy_set_header HTTP_X-Forwarded-For $proxy_add_x_forwarded_for;
      6. }
    • New

      I'm trying to set up a reverse proxy so that subdomain.mydomain.com is redirected to another computer on my internal network.

      I have a router that directs external requests on port 80 and 443 to my OMV/Nextcloud server. This works fine.

      I have subdomain.mydomain.com set up correctly in the DNS. Browsing to it currently connect to my OMV/nextcloud server.

      I am trying to configure a file in nginx that will achieve the reverse proxy.

      I have tried adding the following code both to the end of the openmediavault-webgui file in /etc/nginx/sites-enabled/ and also to a separate file in the same directory.

      Source Code

      1. server {
      2. listen 80;
      3. server_name subdomain.mydomain.com;
      4. location / {
      5. proxy_pass http://somehost:8080/;
      6. proxy_set_header Host $http_host;
      7. proxy_set_header X-Real-IP $remote_addr;
      8. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      9. }
      10. }
      Display All

      On both occasions nginx -t shows no errors, and I reload with nginx -s reload. When I browse to subdomain.mydomain.com I get the OMV login page.

      I have tried the Add Server option via the nginx service page on the OMV webgui... but that causes an error when I try to apply the changes.

      I can see that the nginx OMV page has added the following to the bottom of the zzz-omv-nginx file:

      Source Code

      1. server {
      2. listen 80;
      3. listen [::]:80;
      4. server_name elvie.quested.com.au;
      5. index index.html;
      6. access_log /var/log/nginx/bf380942-08f5-4c49-a8e2-6dd0d1428a57-access.log;
      7. error_log /var/log/nginx/bf380942-08f5-4c49-a8e2-6dd0d1428a57-error.log;
      8. large_client_header_buffers 4 8k;
      9. location / {
      10. proxy_pass http://192.168.178.41:8080/;
      11. proxy_set_header Host $http_host;
      12. proxy_set_header X-Real-IP $remote_addr;
      13. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      14. }
      15. }
      Display All
      That causes nginx to fail because it's trying to access port 80 twice. Removing either (or both) of the listen commands doesn't work. I have to remove that code and sudo fuser -k 80/tcp to get nginx running again.

      So - the nginx plugin doesn't add reverse proxy sites correctly... and I can't work out how to do it manually...

      Any tips?

      - Andrew