我在 nginx 上设置了 2 个网站,应该根据访问的域加载正确的网站。
例如: website1.com website2.com
但是,在访问这两个域中的任何一个时,它们都会加载 website1.com。
我的配置有什么问题?两个配置都在启用站点的单独文件中
website1.com 配置
server {
listen 80;
listen [::]:80 ipv6only=on;
root /var/www/website1.com;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name website1.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri /index.php =404; …Run Code Online (Sandbox Code Playgroud)