nginx reverse proxy doesn't work

  • Code
    server {
        listen [::]:80;
    
    
        location /couchpotato {
            proxy_pass http://localhost:5050;
            proxy_set_header Host localhost:5050;
            proxy_redirect default;
        }
    }


    Wouldn't this be the same thing? Or do I need both then?
    It looks like the same code? Are both needed?




    However, when you want to reach the site through ip/couch, is that the same port as OMV is running at? If that's the case, create a file in /etc/nginx/openmediavault-webgui.d/ and try this content in it:

    Code
    location /couchpotato {
        proxy_pass http://localhost:5050;
        proxy_set_header Host localhost:5050;
        proxy_redirect default;
    }


    I don't think it is possible to use a subdomain on the asus router.
    This is getting harder and harder for me to manage. Still I have no success at all, except that the code runs, but I don't know how to manage this last part. It is so sad, because I can't access my server from everywhere.

  • If that's the case, just go with the last example and don't make it complicated for yourself. There are one difference, the port option :) So go with the last option you quoted.

  • If that's the case, just go with the last example and don't make it complicated for yourself. There are one difference, the port option :) So go with the last option you quoted.


    Do you mean that will make me access it with ip/couch, and not ip/couch:5050 ?


    What should the file be called that I place in
    /etc/nginx/openmediavault-webgui.d/
    ?


  • And just restart nginx?
    I will try it ASAP when I get home.


    Just to be sure, this means I don't have to add anything to my router?


    Thank you very much, hope it works.


    Yes, if it doesn't work post output of nginx -t. You won't have to add anything to your router.


    However, if this port is accessible from the public, the least you could do is enable SSL for web interface :)


  • Yes, if it doesn't work post output of nginx -t. You won't have to add anything to your router.


    However, if this port is accessible from the public, the least you could do is enable SSL for web interface :)


    Doesn't work 404 not found when going to http://192.168.1.2/couchpotato


    This is the output of nginx -t
    root@NAS:~# nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful


    I don't know what to try?

  • I have made some kind of progress, but I still don't reach the site.
    If i enter mydomain.asuscomm.com/couch I will get to this site: mydomain.asuscomm.com/login/?next=%2Fcouch%2F (it somehow recognizes the site, but the page is still 404 not found, nginx).
    If i go to the port number i get to the correct site mydomain.asuscomm.com:5050/login/?next=%2F
    As you can see it is close to the one I get to, but I get an extra "couch%2F". If I remove this extra text nothing more happens.


    But this is progress, before nothing happened and I got straight to a 404.

  • Doesn't work 404 not found when going to 192.168.1.2/couchpotato


    This is the output of nginx -t
    root@NAS:~# nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful


    I don't know what to try?


    You know what, I forgot one thing. The file needs to have conf as file extension. So save the file as /etc/nginx/openmediavault-webgui.d/couchpotato.conf.


    I tried the configuration I gave you and couldn't figure out why it didn't work when I tested it, but that was it :)


  • You know what, I forgot one thing. The file needs to have conf as file extension. So save the file as /etc/nginx/openmediavault-webgui.d/couchpotato.conf.


    I tried the configuration I gave you and couldn't figure out why it didn't work when I tested it, but that was it :)


    I did this change, saved it to openmediavault-webgui.d as a .conf file.
    But it does not work for me.
    Check this screenshot, the URL does look almost correct, but not fully. Still I get a 404.
    I have removed everything else (dnsmasq settings in router, that I tried and the file i created in hosts enabled in nginx)

  • Check this screenshot, the URL does look almost correct, but not fully. Still I get a 404.


    If you look at your screenshot the path is /login/?next=%2Fsick. Did you really set it up that way? If you used my configuration the path should just be /couchpotato. I've tried the config multiple times so I'm pretty confident it works.


  • If you look at your screenshot the path is /login/?next=%2Fsick. Did you really set it up that way? If you used my configuration the path should just be /couchpotato. I've tried the config multiple times so I'm pretty confident it works.


    This is how I set it up exactly:

    Code
    location /couch {
        proxy_pass http://localhost:5050;
        proxy_set_header Host localhost:5050;
        proxy_redirect default;
    }


    And this is what it says after i press enter on asuscomm.com/couch

  • And this is what it says after i press enter on asuscomm.com/couch


    Try this possibly: go to CouchPotato the normal way, go to Settings, General. Press show advanced settings. Change Url Base to couch. Don't know if you need to restart CouchPotato but hopefully it helps. :)


  • Try this possibly: go to CouchPotato the normal way, go to Settings, General. Press show advanced settings. Change Url Base to couch. Don't know if you need to restart CouchPotato but hopefully it helps. :)


    That did actually work great, but I had to write /couch in URL Base.
    SickRage, Transmission and Plex doesn't seem to have this great option though?

  • Normally they don't (probably because they don't expect to run in a subpath). Sometimes it works, and sometimes it doesn't. It mostly depends on if they use some rewrite rules and depend on it to get the correct path and those things can get tricky.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!