请教各位大佬。我通过一键部署搭建了两个wordpress网站A和网站B,通过cloudflare将域名A和域名B指向了服务器。网站A在8080端口,网站B在8082端口。通过ip直连8080端口和8082端口都可以正常访问。域名A可以直接正常访问,域名B不可以,提示404 Not found.
域名A的配置文件如下:
server {
listen 80 ;
server_name A.com;
index index.php index.html index.htm default.php default.htm default.html;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
access_log /www/sites/A.com/log/access.log main;
error_log /www/sites/A.com/log/error.log;
location ^~ /.well-known/acme-challenge {
allow all;
root /usr/share/nginx/html;
}
location / {
proxy_pass http://127.0.0.1:8080;
}
}
域名B的配置文件如下:
server {
listen 80 ;
server_name B.com;
index index.php index.html index.htm default.php default.htm default.html;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
# ## proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
access_log /www/sites/B.com/log/access.log main;
error_log /www/sites/B.com/log/error.log;
location ^~ /.well-known/acme-challenge {
allow all;
root /usr/share/nginx/html;
}
location / {
proxy_pass http://127.0.0.1:8082;
}
}