VPS侦探论坛

 找回密码
 注册
查看: 1891|回复: 5

[求助] 问题见下方描述

[复制链接]
发表于 2022-7-2 10:06:18 | 显示全部楼层 |阅读模式

环境: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 无任何内容。

美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-7-2 12:37:18 | 显示全部楼层


nginx -t 测试一下看是否有错误
贴一下配置文件看一下
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2022-7-2 14:55:01 | 显示全部楼层

licess 发表于 2022-7-2 12:37
nginx -t 测试一下看是否有错误
贴一下配置文件看一下
  1. server
  2.     {
  3.         listen 80;
  4.         listen [::]:80;
  5.         server_name oevon.com ;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwoot/wordpress;

  8.         include rewrite/wordpress.conf;
  9.         #error_page   404   /404.html;

  10.         # Deny access to PHP files in specific directory
  11.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  12.         include enable-php.conf;

  13.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  14.         {
  15.             expires      30d;
  16.         }

  17.         location ~ .*\.(js|css)?$
  18.         {
  19.             expires      12h;
  20.         }

  21.         location ~ /.well-known {
  22.             allow all;
  23.         }

  24.         location ~ /\.
  25.         {
  26.             deny all;
  27.         }

  28.         access_log  /home/wwwlogs/oevon.com.log;
  29.     }
复制代码

  1. server
  2.     {
  3.         listen 80;
  4.         listen [::]:80;
  5.         server_name git.oevon.com ;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/git.oevon.com;

  8.         include rewrite/none.conf;
  9.         #error_page   404   /404.html;

  10.         # Deny access to PHP files in specific directory
  11.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  12.         include enable-php.conf;

  13.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  14.         {
  15.             expires      30d;
  16.         }

  17.         location ~ .*\.(js|css)?$
  18.         {
  19.             expires      12h;
  20.         }

  21.         location ~ /.well-known {
  22.             allow all;
  23.         }

  24.         location ~ /\.
  25.         {
  26.             deny all;
  27.         }

  28.         location / {
  29.             return 301 https://$host$request_uri;
  30.         }

  31.         access_log  /home/wwwlogs/git.oevon.com.log;
  32.     }

  33. server
  34.     {
  35.         listen 443 ssl http2;
  36.         listen [::]:443 ssl http2;
  37.         server_name git.oevon.com ;
  38.         index index.html index.htm index.php default.html default.htm default.php;
  39.         root  /home/wwwroot/git.oevon.com;
  40.         
  41.         ssl_certificate /usr/local/nginx/conf/ssl/git.oevon.com/fullchain.cer;
  42.         ssl_certificate_key /usr/local/nginx/conf/ssl/git.oevon.com/git.oevon.com.key;
  43.         ssl_session_timeout 5m;
  44.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  45.         ssl_prefer_server_ciphers on;
  46.         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$
  47.         ssl_session_cache builtin:1000 shared:SSL:10m;
  48.         # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
  49.         ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

  50.         include rewrite/none.conf;
  51.         #error_page   404   /404.html;

  52.         # Deny access to PHP files in specific directory
  53.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  54.         include enable-php.conf;

  55.         location / {
  56.             proxy_pass http://127.0.0.1:3000;
  57.             proxy_http_version    1.1;
  58.             proxy_cache_bypass    $http_upgrade;                                                
  59.             proxy_set_header Upgrade            $http_upgrade;
  60.             proxy_set_header Connection         "upgrade";
  61.             proxy_set_header Host               $host;
  62.             proxy_set_header X-Real-IP          $remote_addr;
  63.             proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
  64.             proxy_set_header X-Forwarded-Proto  $scheme;
  65.             proxy_set_header X-Forwarded-Host   $host;
  66.             proxy_set_header X-Forwarded-Port   $server_port;
  67.         }

  68.         #location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  69.         #{
  70.         #    expires      30d;
  71.         #}

  72.         #location ~ .*\.(js|css)?$
  73.         #{
  74.         #    expires      12h;
  75.         #}

  76.         location ~ /.well-known {
  77.             allow all;
  78.         }

  79.         location ~ /\.
  80.         {
  81.             deny all;
  82.         }

  83.         access_log  /home/wwwlogs/git.oevon.com.log;
  84.     }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2022-7-2 14:55:19 | 显示全部楼层



nginx -t 正常
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2022-7-2 21:05:27 | 显示全部楼层


配置文件是正常的,不要使用CDN,直接本地hosts到源IP上,清空浏览器测试一下

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2022-7-4 10:02:30 | 显示全部楼层

licess 发表于 2022-7-2 21:05
配置文件是正常的,不要使用CDN,直接本地hosts到源IP上,清空浏览器测试一下 ...

好,我试试,谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-20 10:30 , Processed in 0.026920 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表