0

I'm trying to set up a VPS with a single IP address to run my static homepage and some additional services such as NextCloud. I already have a domain that points to the VPS's IP address. Reading through a number of tutorials on self-hosting, a common solution for this type of scenario is to set up a reverse proxy that forwards to different subdomains, e.g. nextcloud.mydomain.com. However, here's my question:

How can I run my static homepage under the main domain, while having services run under subdomains?

All examples I have seen so far serve static content under another subdomain, e.g. blog.mydomain.com. That's not exactly what I want. In fact, I wonder what the response of the reverse proxy is when I try to access the main domain.

I'm using docker and docker-compose for managing the VPS. So far, I tried the jwilder/nginx-proxy and traefik images as reverse-proxies. Any help (literature, relevant tutorials, github repos, etc.) would be highly appreciated!

ChrKoenig
  • 103
  • 4
  • Does this answer your question? [How can I forward requests from my web server?](https://serverfault.com/questions/1035016/how-can-i-forward-requests-from-my-web-server) – Gerald Schneider Dec 10 '21 at 06:46

1 Answers1

1

Nginx Proxy Manager is what you are looking for: https://nginxproxymanager.com/ It has a fairly simplistic web UI. You can create multiple proxy mappings for all of the subdomains that you want to use. It supports websockets, forwaring, and Let's Encrypt.

You can route traffic using the internal docker network to the containers that are hosting the services.

Linuxx
  • 1,189
  • 8
  • 7
  • Thanks for your answer, but I'm still struggling to understand how I can serve the website without subdomain. I just have a single IP address, and that's where the reverse proxy is running as far as I understand. – ChrKoenig Nov 24 '21 at 20:40
  • I assume you are running all of those sites on the same server, and I also assume all sites are containers. If that's the case, you can assign 443 and 80 to nginx proxy manager, then use the internal container IP network. If the "main domain" is running on the host OS and not in a container, then change the port that the web server is bound to (8080,8443), and then set nginx proxy manager to proxy requests for that hostname to 127.0.0.1:8080. You really haven't given enough information to really properly build a recommendation. I have to make a whole lot of assumptions. – Linuxx Nov 24 '21 at 23:10
  • Yeah...server admin and networking are rather new topics for me, so the question might have been a bit vague. Anyways, I got it done using `nginx proxy manager` by simply adding a proxy host that connects the website container to the domain. I somehow thought that wasn't possible and didn't even think of this most obvious solution. – ChrKoenig Nov 25 '21 at 12:15