我正在尝试为服务器安装新的子域 sports .example.com,并且我有另一个子域,目前在新闻 .example上可以正常使用。 com。问题是,每次我访问体育 .example.com时,它都会重定向到新闻 .example.com。
这两个域都是wordpress网站,如果访问 sports .example.com / info.php ,我可以确认新域名确实是“已解析”的我手动触摸并编辑From
文件。
这是info.php
配置文件sports
:
/etc/nginx/sites-enabled/sports.example.com
这是新闻子域(server {
listen 80;
root /home/sd/sites/sports.example.com;
index index.php index.html index.htm index.nginx-debian.html;
server_name sports.example.com;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/sports.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sports.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = sports.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name sports.example.com;
listen 80;
return 404; # managed by Certbot
}
的配置文件:
/etc/nginx/sites-enabled/news.example.com
我发现this question最接近于may的情况,但是我的系统上没有安装任何代理,该代理具有来自两个具有相同IP地址的相同VPS的子域。不过,如果重要的话,它们是一些django网站。