VPS侦探论坛

 找回密码
 注册
查看: 5087|回复: 6

aws使用lnmp脚本搭建后无法访问https页面

[复制链接]
发表于 2021-8-10 15:17:26 | 显示全部楼层 |阅读模式

本帖最后由 sushome 于 2021-8-10 15:26 编辑

不知道为什么就是无法访问https页面,试过lnmp1.6和1.8。以前都是很快搞定的,http页面请求正常,我的理解是 配置成功的话 即使没有页面也是显示404,否则应该是没有nginx配置错吧?
这次总觉得是aws的问题。ssl证书我试了本来的证书和脚本自动申请的证书都无效。甚至是把所有网页文件设置成777权限都不行,设置成www用户也不行无论如何都是显示:无法访问此网站 ***.com 意外终止了连接。请试试以下办法:请检查网络连接。

aws那边已经设置了443、80端口的出入站规则,另外vpc acl 子网 网关什么的 基本上能设的都设了,基本上把其他流量都允许了还是没能打开https页。
443端口状态:
  1. [root@ip-172-31-44-83 ssl]# lsof -i:443
  2. COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
  3. nginx   4406 root    8u  IPv4  24582      0t0  TCP *:https (LISTEN)
  4. nginx   4407  www    8u  IPv4  24582      0t0  TCP *:https (LISTEN)
  5. nginx   4408  www    8u  IPv4  24582      0t0  TCP *:https (LISTEN)
复制代码


以下是conf配置:
  1. server
  2.     {
  3.         listen 80;
  4.         #listen [::]:80;
  5.         server_name 域名.club www.域名.club;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/目录;

  8.         include rewrite/typecho.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-pathinfo.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/***.club.log;
  29.     }
复制代码


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


不知道是不是篇幅限制,重新发443那部分
  1. server
  2.     {
  3.         listen 443 ssl http2;
  4.         #listen [::]:443 ssl http2;
  5.         server_name 域名.club www.域名.club;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/目录;
  8.         ssl_certificate /home/wwwroot/ssl/full_chain.pem;
  9.         ssl_certificate_key /home/wwwroot/ssl/private.key;
  10.         ssl_session_timeout 5m;
  11.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  12.         ssl_prefer_server_ciphers on;
  13.         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-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-dr$
  14.         ssl_session_cache builtin:1000 shared:SSL:10m;
  15.         # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
  16.         ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

  17.         include rewrite/typecho.conf;
  18.         #error_page   404   /404.html;

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

  21.         include enable-php-pathinfo.conf;

  22.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  23.         {
  24.             expires      30d;
  25.         }

  26.         location ~ .*\.(js|css)?$
  27.         {
  28.             expires      12h;
  29.         }

  30.         location ~ /.well-known {
  31.             allow all;
  32.         }

  33.         location ~ /\.
  34.         {
  35.             deny all;
  36.         }


  37.         access_log  /home/wwwlogs/域名.club.log;
  38.     }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2021-8-10 19:47:56 | 显示全部楼层

lnmp自动生成的配置文件是没问题的,在其他机器上tcping ip 443 或者telnet ip 443 看一下443通不通
不通的话就是aws安全组或者服务器上防火墙未开放443端口
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2021-8-11 12:10:50 | 显示全部楼层



licess 发表于 2021-8-10 19:47
lnmp自动生成的配置文件是没问题的,在其他机器上tcping ip 443 或者telnet ip 443 看一下443通不通
不通的 ...

安全组已经配好一大堆规则 甚至是443所有流量都允许了,telnet ip 80和443在未安装lnmp前是Connection refused,但是安装lnmp后80成功 443不成功。aws管理页面实在找不到相关的防火墙设置,另外服务器的443端口是正在被nginx woker使用的,而且服务器的firewall好像也没有安装没有这个命令
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2021-8-11 12:11:26 | 显示全部楼层

  1. [root@ip-172-31-38-223 wwwroot]# netstat -anltp | grep LISTEN
  2. tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1688/rpcbind        
  3. tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      12471/nginx: worker
  4. tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2258/sshd           
  5. tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      12471/nginx: worker
  6. tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      19424/mysqld        
  7. tcp6       0      0 :::111                  :::*                    LISTEN      1688/rpcbind        
  8. tcp6       0      0 :::22                   :::*                    LISTEN      2258/sshd
复制代码

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

 楼主| 发表于 2021-8-11 17:09:32 | 显示全部楼层

话题已终结,这是因为这服务器被墙了 气死我了
发表于 2021-8-11 19:14:23 | 显示全部楼层

sushome 发表于 2021-8-11 12:10
安全组已经配好一大堆规则 甚至是443所有流量都允许了,telnet ip 80和443在未安装lnmp前是Connection re ...

外网不通如果排除被墙的原因,就是防火墙的原因
1、aws安装其设置问题
2、机器上的iptables、firewalld等之类的可能防火墙挨个去排查
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-20 20:29 , Processed in 0.026697 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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