Есть 2 nginx хоста в виртуальной машине kiosan.loc и sijio.loc. При обращении к sijio.loc открывается kiosan.loc. Если деактивировать kiosan.loc, то sijio.loc открывается.
kiosan.loc.conf:
server {
listen 80;
listen [::]:80;
root /home/web/hosts/kiosan.loc/www;
index index.php
server_name kiosan.loc www.kiosan.loc;
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/run/php/php7.3-fpm-kiosan.loc.sock;
}
location / {
try_files $uri $uri/ =404;
}
access_log /home/web/hosts/kiosan.loc/logs/access_log;
error_log /home/web/hosts/kiosan.loc/logs/error_log;
}
sijio.loc.conf:
server {
listen 80;
listen [::]:80;
root /home/web/hosts/sijio.loc/www;
index index.php
server_name sijio.loc www.sijio.loc;
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/run/php/php7.3-fpm-sijio.loc.sock;
}
location / {
try_files $uri $uri/ =404;
}
access_log /home/web/hosts/sijio.loc/logs/access_log;
error_log /home/web/hosts/sijio.loc/logs/error_log;
}
nginx.conf:
events {
worker_connections 1024;
multi_accept off;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
client_max_body_size 64m;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main buffer=16k flush=2m;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
keepalive_requests 100;
server_tokens on;
# gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Симлинки в sites-enabled есть.
default хост удален (и в sites-available и в sites-enabled).
После всех изменений nginx перезагружал.
В site-enabled ничего лишнего нет. Только 2 симлинка.
При проверке на ошибки (nginx -t) выдает:
nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful