【发布时间】:2020-10-15 16:55:09
【问题描述】:
所以我管理域 britoanderson.com 并试图让 ssl 处理它。 我使用 certbot 为两个 www 制作证书。子域和主要 britoanderson.com 域。 我将 cloudflare 设置为“完整”加密模式。 出于某种原因,SSL 证书适用于https://www.britoanderson.com/,但不适用于网站拒绝打开的https://britoanderson.com/。
这是我的 nginx 默认文件:
server {
if ($host = www.britoanderson.com) {
return 301 https://www.$host$request_uri;
} # managed by Certbot
if ($host = britoanderson.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/;
index index.php index.html index.htm;
server_name britoanderson.com www.britoanderson.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl on;
ssl_certificate /etc/letsencrypt/live/britoanderson.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/britoanderson.com/privkey.pem; # managed by Certbot
root /var/www/html/;
index index.php index.html index.htm;
server_name britoanderson.com www.britoanderson.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
主域 britoanderson.com 和子域 www 的 A 记录均已在 cloudflare 上设置。
我做错了什么?为什么主网站直接拒绝打开?
【问题讨论】:
-
不拒绝为我打开。
-
我每次尝试访问 britoanderson.com 时都会收到 ERR_CONNECTION_TIMED_OUT ,但 www 子域确实有效。我什至尝试从不同的设备访问它,结果相同