Answer the question
In order to leave comments, you need to log in
Nginx sites on the same ip?
there is a server, on it several sites all on different ip
configs of each site begin so
listen ***.***.***.***:80;
server_name domain.com;
root /var/www/domain.com/html;
index index.php;
Everything works fine
on 1 ip, it was necessary to hang up a few more sites
with the same config for each domain on this ip, the same site opens.
What is the reason? How to decide?
Upd: Full config
It differs for different sites only by domain
server {
listen xxx.xxx.xxx.xxx:80;
return 301 https://domain.com$request_uri;
server_name domain.com;
}
server {
listen xxx.xxx.xxx.xxx:443 ssl;
server_name domain.com;
root /var/www/domain.com/html;
index index.php;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security max-age=31536000;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
# access_log logs/static.log; # I don't usually include a static log
}
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|woff)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/domain.com/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
If everything is exactly as you said, then everything should work. But I understand you missed a lot. Throw off configs I will prompt where you stumble.
1. To understand how Nginx handles requests, be sure to read this
2. Also, be sure to define default_server, for example, in the /etc/nginx/conf.d/fallback.conf file (the path may change, see include in nginx.conf) you can write :
server {
listen XX.XX.XX.XX:80 default_server;
server_name _;
return 444;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question