etique57 1 Posted May 1, 2018 Posted May 1, 2018 Hello, I have setup a frontend server and I want to use Nginx as a reverse proxy, based on an ubuntu-server, to redirect the inbound connections to my emby server. I searched the forums but cannot find what I'm looking for: I would like to reverse proxy not to emby.mydomain.com but to mydomain.com/emby Would anyone have an example of such a file? The closest I found was this: location /emby { proxy_pass http://server:8096; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $remote_addr; proxy_set_header X-Forwarded-Protocol $scheme; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } but it doesn't work. Coming from apache2, I'm also a bit confused by how to structure the files in sites-available (with apache2 I could just drop-in locations with no problem)... Using sites-available, I would like to add locations to the main server instance, not new servers. Not sure how I can do that. I'm not sure either if I can use hostnames with nginx (or if I need to use only IPs...) Thanks for any hint!
mastrmind11 722 Posted May 1, 2018 Posted May 1, 2018 Hello, I have setup a frontend server and I want to use Nginx as a reverse proxy, based on an ubuntu-server, to redirect the inbound connections to my emby server. I searched the forums but cannot find what I'm looking for: I would like to reverse proxy not to emby.mydomain.com but to mydomain.com/emby Would anyone have an example of such a file? The closest I found was this: location /emby { proxy_pass http://server:8096; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $remote_addr; proxy_set_header X-Forwarded-Protocol $scheme; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } but it doesn't work. Coming from apache2, I'm also a bit confused by how to structure the files in sites-available (with apache2 I could just drop-in locations with no problem)... Using sites-available, I would like to add locations to the main server instance, not new servers. Not sure how I can do that. I'm not sure either if I can use hostnames with nginx (or if I need to use only IPs...) Thanks for any hint! That's how you would do it. What does "doesn't work" mean? What else have you tried? And since your SSL cert *has* to be tied to a valid domain name, an IP address won't work externally. Internally you can route external connections to anything you want on your network. I'm surprised you can't get this to work, there are boatloads of documentation on nginx both here and on the internet. Post your whole nginx config and we can go from there.
pir8radio 1312 Posted May 1, 2018 Posted May 1, 2018 (edited) Hello, I have setup a frontend server and I want to use Nginx as a reverse proxy, based on an ubuntu-server, to redirect the inbound connections to my emby server. I searched the forums but cannot find what I'm looking for: I would like to reverse proxy not to emby.mydomain.com but to mydomain.com/emby Would anyone have an example of such a file? The closest I found was this: but it doesn't work. Coming from apache2, I'm also a bit confused by how to structure the files in sites-available (with apache2 I could just drop-in locations with no problem)... Using sites-available, I would like to add locations to the main server instance, not new servers. Not sure how I can do that. I'm not sure either if I can use hostnames with nginx (or if I need to use only IPs...) Thanks for any hint! I personally am not a fan of the location base proxying of emby.... That said, I would not depend on /emby working with all apps... See my solution here and see if it helps: https://emby.media/community/index.php?/topic/45351-sync-with-reverse-proxy-not-working-correctly/?p=425907 basically your new config would be: location /emby/ { #note the backslash after emby rewrite ^/emby(/.*)$ $1 break; #this will strip /emby from the requests going into emby backend proxy_pass http://server:8096; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $remote_addr; proxy_set_header X-Forwarded-Protocol $scheme; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } Edited May 1, 2018 by pir8radio 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now