Привет! Есть два docker-compose (почти одинаковые):
version: "3.5"
services:
server1:
build: server/
tty: true
command: node server.js
ports:
- "8080:8080"
volumes:
- /etc/letsencrypt:/etc/letsencrypt
client1:
build: client/
tty: true
depends_on:
- server1
volumes:
- /var/www/html/cpanel/:/var/www/html/cpanel/
- /etc/letsencrypt:/etc/letsencrypt
ports:
- "8080:8080"
Как мне два таких запустить? Тоесть два сайта. В client Dockerfile билдится vue и запускается nginx, вот кфг его:
server {
listen 80;
listen [::]:80;
server_name cpanel.xmusk.net;
return 301 https://cpanel.xmusk.net;
}
server {
location / {
root /client/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
server_name cpanel.xmusk.net;
location ~ \.(|gif|swf|ico||xml|txt|)$ {
root /var/www/html/cpanel/client;
}
location /robots.txt {
alias /var/www/html/cpanel/client/robots.txt;
}
location /api/ {
proxy_pass https://cpanel.xmusk.net:8080/api/;
}
listen 443 ssl;
listen [::]:443 ssl;
#ssl on;
ssl_certificate /etc/letsencrypt/live/cpanel.xmusk.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/cpanel.xmusk.net/privkey.pem; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/cpanel.xmusk.net/chain.pem;
}
server {
listen 80;
listen [::]:80;
server_name xmusk.net;
return 301 https://xmusk.net;
}
server {
location / {
root /client/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
location ~ \.(|gif|swf|ico||xml|txt|)$ {
root /var/www/html/test/client;
}
location /robots.txt {
alias /var/www/html/test/client/robots.txt;
}
location /api/ {
proxy_pass https://xmusk.net:8080/api/;
}
listen 443 ssl;
listen [::]:443 ssl;
server_name xmusk.net;
#ssl on;
ssl_certificate /etc/letsencrypt/live/xmusk.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xmusk.net/privkey.pem; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/xmusk.net/chain.pem;
}
И чтобы все это работало на одних и тех же портах? Тоесть проще говоря - два сайта, один на поддомене, другой просто на поддомене.