Nginx Web server
192.168.0.214
WordPress
192.168.0.211
Zimbra web email
192.168.0.213
apt install nginx
vi /etc/nginx/conf.d/local_domains.conf
server {
listen 80;
server_name mail.yourdomain2.com;
location / {
set $target http://192.168.0.213:80;
proxy_pass $target;
}
}
server {
listen 80;
server_name yourdomain1.com www.yourdomain1.com;
location / {
set $target http://192.168.0.211:80;
proxy_pass $target;
}
}
server {
listen 443 ssl http2;
server_name yourdomain1.com www.yourdomain1.com;
ssl_certificate /etc/nginx/certs/yourdomain1.com.crt;
ssl_certificate_key /etc/nginx/certs/yourdomain1.com.key;
location / {
set $target https://192.168.0.211:443;
proxy_pass $target;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
}
}
server {
listen 443 ssl http2;
server_name mail.yourdomain2.com;
ssl_certificate /etc/nginx/certs/Cert.txt;
ssl_certificate_key /etc/nginx/certs/Private.txt;
location / {
proxy_pass https://192.168.0.213:443;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_read_timeout 5m;
}
}