自托管网站使用 https 时仅显示路由器登录页面

自托管网站使用 https 时仅显示路由器登录页面

正如标题所说,当我访问我的网站时https://example.com它显示我的路由器登录页面,而不是index.html。例如,当我访问网站上的特定页面时http://example.com/foo.html(注意http而不是https)这样就很好了。另一个注意事项:只是要http://example.com重定向到 https 版本,所以我必须指定http://example.com/index.html获取默认页面。

该网站之前使用 nginx 时可以正常运行,但在摆弄了球童它不再起作用了。我已经删除了 Caddy 并恢复到 nginx,但它不再像以前那样工作了。

Caddy 是一个自动获取 SSL 证书的 Web 服务器。我不确定如何从我的网站中删除 SSL。也许可以通过 Let's encrypt 直接删除?但我不知道怎么做。

我怀疑 Caddy 弄乱了一些设置,但我不知道是哪个设置搞错了,也不知道该如何修复。

该网站托管在我家的一台运行 Ubuntu 的笔记本电脑上。

我将非常感激您能给我的任何帮助和建议。谢谢!

注意:我曾在 Server Fault 上询问过,但显然与主题无关。

修剪 /etc/nginx/sites-enabled/default 的内容:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /home/viktor/website;

    index index.html index.htm index.nginx-debian.html;

    server_name example.com;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }
}

删减内容/etc/nginx/nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;


    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;


    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;


    gzip on;
    gzip_disable "msie6";


    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

答案1

检查路由器配置,看看是否可以禁用“通过 WAN 端口管理”。如果路由器在 WAN 接口的 443 端口上打开了自己的侦听器,则路由器无法在 WAN 接口的 443 端口上进行 NAT 环回。

如果这不起作用,那么您的路由器肯定存在缺陷,无法正确处理端口 443 的 NAT 环回(又名 NAT Hairpinning)。

如果你确实需要从 WAN 端管理路由器,看看你是否可以告诉它将其管理 UI Web 服务放在备用端口而不是 443 上。假设你把它放在 50443 上。然后你就可以连接到路由器的管理 UI,https://example.com:50443/

相关内容