A
A
AndersDir2021-02-18 14:46:43
Nginx
AndersDir, 2021-02-18 14:46:43

How to maintain multiple sites on one server?

Hey! My name is Andrey.

I'm a web developer, but I don't have much knowledge in the server side. I have a VPS server that hosts various sites during development. It turns out there are:
- Folders with sites.
- Single database.

At the output, we have problems in the form:
- In the addresses of sites, ports like dev.site.com:2421
- A bunch of different software is installed

I would like to do everything through docker.
Ideally, each site has its own docker-compose, in which everything you need is already there and to be isolated.

I can still do this, but each site and each of its components needs to come up with its own random ports so that they do not intersect:
- php dev.site.com:2341
- bd dev.dite.com:1234
- redis dev.site.com:5422
etc.
It's infuriating.

Prompt, please:
- How it is possible to solve a problem of ports? You can live with them, but it seems it's not serious. I use nginx at a basic level.
- Is it generally a normal structure when each site is separate with its own database and other services in a separate directory? Or is it better to do otherwise? For example, a DB to launch one for all and to distribute accesses.

Perhaps in general some other approaches are used, I'm wrong and in general you need to start a separate server for each site.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Dmitriev, 2021-02-18
@SignFinder

Use nginx as a reverse proxy either on the VDS host itself, or for example via https://github.com/nginx-proxy/nginx-proxy
Then the ports will be standard for all sites - 80 and 433

S
Sanes, 2021-02-18
@Sanes

LAMP/LEMP doesn't need docker.
For each site PHP-FPM pool from a separate user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question