Home

Hosting Dockerized website on VPS with Apache

$$16122
https://lemmy.wtf/u/bestbakerycookie posted on Mar 22, 2026 19:34

I made a Docker container of a website that’s difficult to deploy, and I can reliably deploy it on localhost on my personal machine. The container sets up an Apache server with all the files and config to run the website.

However, the story is different on my VPS running Ubuntu and Apache. I have two other websites running on the same VPS, each with different domains, and when I deploy the dockerized website I can’t access that site. I opened ports on UFW. The Docker container sets the site to run on port 8000, and I tried running a reverse proxy on just that site with Apache by defining a config pointing towards the internal Docker IP on port 8000, but no luck.

Now I’m thinking of running a reverse proxy, but I haven’t found any guides covering my situation: routing websites on both the host machine and through Docker. nginx-proxy looks to cover only Docker containers, and the Apache reverse proxy couldn’t access the Docker container.

What are my options here? I plan to dockerize everything eventually, but that will be sometime in the future and not right away.

https://lemmy.wtf/post/39865709
Reply
$$16123
https://infosec.pub/u/ryokimball posted on Mar 22, 2026 19:42
In reply to: https://lemmy.wtf/post/39865709

I am sick and slightly out of my mind anyway so I’m not going to be very helpful. One thing that stands out though, if you can SSH the machine and you can curl local host to Port 8,000 or whatever. This should help you troubleshooting the container while it lives on the VPS I think

https://infosec.pub/comment/20981865
Reply
$$16132
https://lemmy.zip/u/frongt posted on Mar 22, 2026 19:58
In reply to: https://lemmy.wtf/post/39865709

You need to provide a lot more information about your environment and how the server is configured, and any useful log info.

https://lemmy.zip/comment/25423436
Reply
$$16148
https://lemmy.horwood.cloud/u/mhzawadi posted on Mar 22, 2026 20:08
In reply to: https://lemmy.wtf/post/39865709

First off, when you run a container without an outside IP set. Docker will bind that port, in your case 8000 to all ports. So hitting any of the domains on the vps on port 8000 should show your docker site.

Second, if your VPS is like my OVH VPS then it has only an internet IP. So any open ports are open to the internet at large.

If you want to host lots of sites on a single IP, then you will need a reverse proxy of some sort. I would recommend that your docker site is using 127.0.0.1:8000:8000 so that it’s only visible on the VPS. (If your ports are different then use what you and prefix 127.0.0.1)

I run similar to your setup, nextcloud is in a VM and lots of docker sites. What do you need to know?

https://lemmy.horwood.cloud/comment/2046036
Reply
$$16167
https://palaver.p3x.de/u/hendrik posted on Mar 22, 2026 21:20
In reply to: https://lemmy.wtf/post/39865709

Yeah, You’ll have to do a lot more troubleshooting than this. Did Docker successfully bind to port 8000? Can you curl it from the VPS itself? Does the container and the things in it run properly? Are there any error messages?

https://palaver.p3x.de/comment/3681290
Reply
$$16170
https://lemmy.blahaj.zone/u/MangoPenguin posted on Mar 22, 2026 21:35
In reply to: https://lemmy.wtf/post/39865709

Start with basic diagnostics, see if apache is running inside the container, if it is can you curl from inside the container, if that works did docker create the firewall rule to expose the port or is the VPS overriding things in some way?

Gotta start with the basics.

https://lemmy.blahaj.zone/comment/19746743
Reply
$$16594
https://lemmy.wtf/u/bestbakerycookie posted on Mar 23, 2026 21:29
In reply to: https://lemmy.wtf/post/39865709

I realized I didn’t specify that the other two websites on the host are running directly and without docker. I updated the post with that note.

https://lemmy.wtf/comment/20665028
Reply
$$16595
https://lemmy.wtf/u/bestbakerycookie posted on Mar 23, 2026 21:31
In reply to: https://lemmy.horwood.cloud/comment/2046036

Thanks for the reply. I can see that the port is bound and I enabled the ports in UFW. I have a hybrid setup where the other two websites are run directly on the host without Docker and now I’m introducing a Docker container for the new deployment. Did you have a similar setup?

https://lemmy.wtf/comment/20665059
Reply
$$16601
https://lemmy.decronym.xyz/u/Decronym posted on Mar 23, 2026 21:40
In reply to: https://lemmy.wtf/post/39865709

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

Fewer Letters More Letters
IP Internet Protocol
SSH Secure Shell for remote terminal access
VPS Virtual Private Server (opposed to shared hosting)

[Thread #186 for this comm, first seen 23rd Mar 2026, 21:40] [FAQ] [Full list] [Contact] [Source code]

https://lemmy.decronym.xyz/comment/20504
Reply
$$16713
https://lemmy.horwood.cloud/u/mhzawadi posted on Mar 24, 2026 06:45
In reply to: https://lemmy.wtf/comment/20665059

Ok, the docker container will need to be on a different port to your proxy Something like 127.0.0.1:8080:80

In your proxy, the upstream will be 127.0.0.1:8080.

This should give you what you need

https://lemmy.horwood.cloud/comment/2050440
Reply