[求助] 问题见下方描述
环境:LNMP 1.9正式版、docker 20.10.17使用 vhost 命令创建了两个网站:git.xxx.com 和 xxx.com。两个网站均部署了强制 HTTPS(Let's Encrypt)。并且使用了阿里云的 HTTPS 全站加速(即域名使用 CNAME 解析到阿里云的加速地址)。
其中 git.xxx.com 是通过反向代理docker容器创建的站点。 xxx.com 是 WordPress
反向代理 nginx 配置如下:
location / { proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_cache_bypass $http_upgrade; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto$scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; }
以上两个网站均通过正常命令部署,没有做额外 nginx 配置
问题:git.xxx.com 正常访问,但访问 xxx.com 显示的内容是 git.xxx.com 站点的内容控制台无任何报错。xxx.com.log 无任何内容。
nginx -t 测试一下看是否有错误
贴一下配置文件看一下 licess 发表于 2022-7-2 12:37
nginx -t 测试一下看是否有错误
贴一下配置文件看一下
server
{
listen 80;
listen [::]:80;
server_name oevon.com ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwoot/wordpress;
include rewrite/wordpress.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log/home/wwwlogs/oevon.com.log;
}
server
{
listen 80;
listen [::]:80;
server_name git.oevon.com ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/git.oevon.com;
include rewrite/none.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
location / {
return 301 https://$host$request_uri;
}
access_log/home/wwwlogs/git.oevon.com.log;
}
server
{
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name git.oevon.com ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/git.oevon.com;
ssl_certificate /usr/local/nginx/conf/ssl/git.oevon.com/fullchain.cer;
ssl_certificate_key /usr/local/nginx/conf/ssl/git.oevon.com/git.oevon.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SH$
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
include rewrite/none.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto$scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
#location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
#{
# expires 30d;
#}
#location ~ .*\.(js|css)?$
#{
# expires 12h;
#}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log/home/wwwlogs/git.oevon.com.log;
} nginx -t 正常 w149200 发表于 2022-7-2 14:55
配置文件是正常的,不要使用CDN,直接本地hosts到源IP上,清空浏览器测试一下 licess 发表于 2022-7-2 21:05
配置文件是正常的,不要使用CDN,直接本地hosts到源IP上,清空浏览器测试一下 ...
好,我试试,谢谢
页:
[1]