I have an nginx server with several servers, basically the config file looks like this:
http {
server {
listen [::]:80;
listen 80;
server_name DOMAIN1.com www.DOMAIN1.com;
location ~ \.php$ {
// ...
fastcgi_pass unix:/run/php/DOMAIN1-php7.3-fpm.sock;
}
listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/DOMAIN1/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/DOMAIN1/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
listen [::]:80;
listen 80;
server_name DOMAIN2.com www.DOMAIN2.com;
location ~ \.php$ {
// ...
fastcgi_pass unix:/run/php/DOMAIN2-php7.3-fpm.sock;
}
listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/DOMAIN2/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/DOMAIN2/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
}
When I open DOMAIN1.com the page usually loads. But when I refresh the page several times, I will eventually get the contents of DOMAIN2.com - the same happens on DOMAIN2.com
I have 10 domains in total, and there is no "default" domain; i.e. when a wrong site is served, it's always a different one.
I can actually observe a pattern: When I make a request to a domain it works. Then I open a different browser and load a different domain. Then I refresh the first browser it serves the domain that I just opened on the second browser.
Any idea how I could debug/fix this or what configuration actually triggers this behavior?