gpt4 book ai didi

ssl - Nginx HTTPS 连接被拒绝

转载 作者:行者123 更新时间:2023-12-04 22:36:20 27 4
gpt4 key购买 nike

我无法让 SSL 与我的 Nginx 安装一起工作。我发现了一些与此相关的其他问题,但它们并没有解决我的问题。
我做的检查:

  • nginx -t返回没有错误
  • ufw disable让所有流量低谷
  • netstat -nltp告诉我 tcp:0.0.0.0:80tcp:0.0.0.0:433转至 nginx: master
  • curl -v https://mywebsite.nl返回 Failed to connect to mywebsite.nl port 443: Connection refused
  • curl -v http://mywebsite.nl返回正常

  • 奇怪的事情:
  • netstat -peanut | grep ":80 "返回 tcp:0.0.0.0:80绑定(bind)到nginx: master但是当我尝试 netstat -peanut | grep ":443 "它什么都不返回?
  • 如果我尝试 nmap -p 433 mywebsite.nl它返回 433/tcp filtered nnsp虽然我希望端口像端口 80
  • 一样打开

    我将我的 CA 证书与我自己的证书捆绑在一起(按照 Nginx 文档中提到的正确顺序)。
    我的 Nginx-conf 看起来像这样:
    server {
    listen 80;
    listen 433 ssl http2;

    ssl_certificate /etc/ssl/certs/mywebsite.nl-bundle.crt;
    ssl_certificate_key /etc/ssl/certs/mywebsite.nl.key;

    server_name *.mywebsite.nl;
    root /var/www/mywebsite-app/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
    try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
    deny all;
    }

    if ($scheme != "https") {
    return 301 https://$host$request_uri;
    }
    }

    最佳答案

    listen 433 ssl http2;


    它应该是 443,而不是 433。另请参阅错误消息,它还说它尝试连接到端口 443:

    Failed to connect to covidtesta4.nl port 443: Connection refused

    关于ssl - Nginx HTTPS 连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64145443/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com