我很难让SSL与我的Nginx安装一起工作。我发现了一些与此相关的其他问题,但他们并没有解决我的问题。
我查过了:
nginx -t返回没有errorsufw disable,让所有流量troughnetstat -nltp告诉我tcp:0.0.0.0:80和tcp:0.0.0.0:433转到nginx: mastercurl -v https://mywebsite.nl返回Failed to connect to mywebsite.nl port 443: Connection refusedcurl -v http://mywebsite.nl返回OK奇怪的事:
netstat -peanut | grep ":80 "返回绑定到nginx: master的tcp:0.0.0.0:80,但是当我尝试netstat -peanut | grep ":443 "时,它什么也不返回?如果我尝试nmap -p 433 mywebsite.nl,它返回433/tcp filtered nnsp,而我预期端口将打开,就像它对端口80所做的那样
我将我的CA证书与我自己的证书捆绑在一起(按照Nginx文档提到的正确顺序)。
我的看起来是这样的:
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;
}
}发布于 2020-09-30 20:48:45
监听433 ssl http2;
应该是443而不是433。还请参见错误消息,该消息还说明它试图连接到端口443:
未能连接到covidtesta4.nl端口443:连接拒绝
https://stackoverflow.com/questions/64145443
复制相似问题