【发布时间】:2022-01-24 21:11:06
【问题描述】:
下面是我的 nginx 配置。我修改了“默认”文件(位于“可用站点”中)。我可以通过“http”访问该网站。但是当我尝试通过“https”时,连接超时并且无法访问该页面。 Nginx 奇怪地没有在日志中输入任何条目(包括 access.log 和 error.log)。我正在寻求帮助,因为我对此完全陌生。
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80;
listen [::]:80;
root /var/www/main.x.com/html;
index index.html
server_name main.x.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
server {
listen 443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/letsencrypt/live/main.x.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/main.x.com/privkey.pem;
server_name main.x.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
root /var/www/main.x.com/html;
index index.html;
}
}
【问题讨论】:
-
您确定连接到端口 443 的连接没有被服务器上的某种防火墙阻止吗?
-
@IvanShatsky 防火墙的状态为非活动状态(sudo ufw status)
标签: nginx ssl https backend certbot