

A place to share, discuss, discover, assist with, gain assistance for, and critique self-hosted alternatives to our favorite web apps, web services, and online tools.
I need help setting up an Nginx reverse proxy.
This is my goal:
-
example.com -- a simple static website
-
example.com/nextcloud -- proxies to my nextcloud server
-
example.com/jellyfin -- proxies to my jellyfin server.
I've tried following many tutorials and reading the documentation, but I can't seem to figure it out. Currently, I have Nginx running on a raspberry pi 4 and my services running on a separate computer. Nginx does serve a simple website, but it doesn't proxy. How can I get it to proxy like the example above?
This is the code I made. I'm sure I did something wrong, but here it is anyway. I can proxy ports just fine, but trying to proxy a subdirectory doesn't work. I don't know how to indent on Reddit, so the code is hard to read.
http{
server {
listen 80;
# serves the simple website
location / {
root /data/www
}
# my attempt at proxying a subdirectory
location /jellyfin/ {
proxy_pass http: 192.168.x.x:8096;
}
}
}
events{}
Any help would be appreciated. I am very much a noob when it comes to self-hosting.
Doing this without subdomains (app1.example.com) is a pain in the but.
Just use subdomains.
How do I do that? I'm very new to this. I thought using subdirectories would be easier.
you could take a look at nginx proxy manager and use something like "nextcloud.example.com", "jellyfin.example.com"
Mine look something like:
But it should also be said that the server that is hosting on the other end of the proxy needs to be configured to serving out of a subdirectory.
In other words, if you normally hit jellyfin at http://192.168.0.10, but want to set your reverse proxy as /jellyfin/, then you need to be able to access jellyfin it at http://192.168.0.10/jellyfin first.
I think you can use rewrites to get around that, just been too lazy to learn new things LOL
edit: Try something like this:
While I would recommend nginx proxy manager, which will do all the things you are asking, if you want to be able to understand what you're doing and see and generate example configs, take a look at this: https://www.digitalocean.com/community/tools/nginx
I personally use swag. Its very straightforward and it already has subdomain and subfolder config samples for many services, including ones you mentioned.
There are a lot of problems with swag, there is a bunch of funky stuff in the configuration of it that you will run into eventually. It has some really odd buffering settings that break and cause problems with lots of underlying sites. I don't recommend it, used it for well over a year and all the problems I had boiled down to swag.
Let me make the case for Caddy. I used swag and its precursor for a long time before eventually the problems were just so obvious I had to change. Initially I tried nginx proxy manager and while it is easier to work with than swag it is still actually quite a lot of configuration work because nginx is a lot of work. The console access also turned out to be an issue for us given this was a public facing server.
So I tried caddy out and its a lot easier to get working. Its defaults are sensible, it performs really well and it has been rock solid stable and problem free. I think its the best one especially given how well it can deal with self certificates as well.
I'd recommend Caddy since it's config is super easy, and caddy automatically handles SSL certificates.
So you have your router port forwarding 80/443 to your webserver, then you just need to setup your Caddyfile.
As others said, just use subdomains.
Done