A
A
Anton Misyagin2019-02-20 16:07:06
Web servers
Anton Misyagin, 2019-02-20 16:07:06

How to host multiple sites on your server?

I already asked a question similar to this one, but I will add and clarify it. Here is an updated block diagram:
5c6d4f267f2a6172949612.jpeg
My old question:

Good afternoon, there is a server on which the rail application was running. Nginx is used as a web server and listens on ports 80 and 443. The whole economy is stuffed into containers. Now I have written a blog on WordPress and I want to host it on the same server. I downloaded the official images, raised the containers. Apache is there. SSL will not be used on the blog. Please tell me how to set up the system. I am providing a block diagram. I do not understand, for example the following things. Do I need two webservers and apache and nginx. Apache is immediately built into the official docker image and works out of the box. Nginx set up for a long time, there is ssl. It jars me that I have to edit the nginx configs in STACK1 indicating that there is STACK2 - this is somehow not kosher, all of a sudden I will have to spread these sites to different servers in the future. I want that in the settings of site1 and its web server only site1 is mentioned and site2 is not touched. Or will it not work? Or maybe another one is placed behind these web servers, which decides where to go to the request to nginx or apache. Has anyone done something similar and what is the best way to do it?

They answered that you need to set proxy reverse and put ssl on it.
There is a system that is described in docker-compose files - two projects. One of the projects uses ssl and http2 and a configured web server on nginx, the second one does not use either ssl or http2. The task, having both stacks configured, is to wrap it in some kind of shell (such as a docker network) and fasten a proxy that resolves domain names. In short, so that I can easily take the entire stack and deploy it on another server separately from another stack. There are blocks with question marks in the picture. What are these entities that can change ports? What should be the setting of nginx reverse proxy with a question mark, can you give at least an approximate configuration from memory? In general, is it possible to build a system that will work without touching DOCKER STACK1 and DOCKER STACK 2 (because they are fully working separately from each other)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2019-02-20
@procode

I would not put it on one server, but put it on two at once.
It seems to be faster and more practical.

A
akdes, 2019-02-20
@akdes

nginx-proxy is called. There is also an implementation with letsencrypt - then SSL will be automatically pulled up.
The proxy will listen on port 80 and connect the required docker bundle depending on the requested host

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question