nginx Reverse proxy

  • Hello!


    Looking for help to achieve reverses proxy:


    i actually can reach my OMV nas with nas.domain.local and nextcloud.domain.local.


    What i'm looking to do is reaching my nextcloud (wich is indeed hosted on OMV on https port 8095) with this url: nextcloud.domain.local
    AS far as i understand, i need to route this FQDN to localhost:8095 (HTTPS)


    but i dont get how to achieve this using nginx plugin.


    Thoses URL's actually works: nas.domain.local:8095 and nextcloud.domain.local:8095



    Would be great if someone could point me all the right settigns to setup in nginx plugin!


    Another thread was discussing this and i already asked there with no luck:
    NGINX Reverse proxy + vitual hosts




    Thanks for your help !

  • Couldn't you achieve this with the name-based listening option on NGinx with the reverse proxy listening on the default route?


    Adding something like the code below to the "extra options" field should be enough to route all requests to the NGinx server to your nextcloud server:


    Bash
    location / {
    proxy_headers_hash_max_size 512;
    proxy_headers_hash_bucket_size 64;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    add_header Front-End-Https on;
    proxy_pass http://127.0.0.1:8095;
    }


    Then you would have to set up nextcloud config: https://docs.nextcloud.com/ser…_proxy_configuration.html

  • Hey! thanks for your help and answer.


    I dont want all request to be sent to nextcloud, only the one using hostname nextcloud.domain.local


    I may be doing something wrong : but: may you clarify wich options i should use in nginx plugins?
    If i select http it doesen't work neither https - there's an option for https but it ask for a certificate (wich i already have in destination dockerso it's usless)


    also this " proxy_pass http://127.0.0.1:8095;" seems strange cause i want to use https :-)


    Regards

  • I dont want all request to be sent to nextcloud, only the one using hostname nextcloud.domain.local

    If you use the "name-based" host type, NGinx should only respond to requests for that domain (now, you would have to have the domain pointed to the server's IP which, it sounds like you do).



    I may be doing something wrong : but: may you clarify wich options i should use in nginx plugins?


    I hope this screenshot helps you:
    98b82854a38337b342770c35c.png


    As you can see the "Server Name" should be the domain name you want NGinx to respond to. Then, putting the code I sent previously inside this server would send all requests to "nextcloud.domain.local" to the nextcloud server.



    also this " proxy_pass 127.0.0.1:8095;" seems strange cause i want to use https

    Yes, NGinx handles the SSL stuff. This just shows NGinx where it can send the data to. Since NGinx and your nextcloud server are on the same machine (assumption) you are OK to have an insecure connection here.

Participate now!

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