Multiple Websites On One Web Server

Hello,

I want to run a web server using docker that is able to run multiple websites at the same time.
It did not become clear from reading the documentation if this is possible in the following way:

I want the container running the server, separate from the data of the websites.
I want to be able to start and stop a website individually. The web server that I have been looking at is nginx. When you want to run a site using nginx, you place a configuration file in a folder called “sites-enabled” and then run nginx reload.

To start and stop websites the following steps are required.
When I run a website these are the required steps: should put the config file in the folder, provide the static content of the website to the container running nginx-server and optionally run a new container for the dynamic content.
When stopping, the website container should be stopped the content removed from the nginx-server container and the config file removed.

Is something like this possible using docker?

Additional information:
I run docker on a raspberry pi

Thanks in advance

This is indeed very possible.

There are two main projects that I’m aware of that try to help set up a reverse proxy with the proper config files and reload as needed. There interlock, and jwilder/nginx-proxy. Both of these projects will watch the docker events stream and look for containers meeting a certain criteria, and then set up a config file for nginx (or haproxy) to route traffic to those places.

Since you’re running docker on ARM, you’ll probably need to build your own copies of those images, using an ARM base.

1 Like