我使用的是Laravel,并停止使用它,因为我的卡有问题。所以我继续我自己的数字海洋。
我按照下面的instructable对站点应用SSL。https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04-es
这个过程显示了一些错误,例如::。
maquino@codigobyte:/etc/nginx/sites-enabled$ sudo nginx -t
nginx: [warn] conflicting server name "todocontenidoweb.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.todocontenidoweb.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "todocontenidoweb.com" on [::]:80, ignored
nginx: [warn] conflicting server name "www.todocontenidoweb.com" on [::]:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
问题是,我的网站已经关闭,我已经在第三天和数字海洋支持告诉我,他们没有看到一个问题的配置。但是网站已经关闭了。在下一页中,它向我展示了安全连接的一个问题。
https://www.ssllabs.com/ssltest/analyze.html?d=todocontenidoweb.com
目前,有几件事情让我相信在以下配置中存在问题: in /etc/nginx/ site -启用了$我有3个文件,其中之一是我的站点todocontenidoweb.com In todocontenidoweb.com:
server {
listen 80;
listen [::]:80;
server_name todocontenidoweb;
server_tokens off;
root /home/forge/todocontenidoweb.com/public;
在server_name行中,所有web内容;我知道我应该放置todocontenidoweb.com www.todocontenidos web.com,但是它不允许我,如果我这样做,它会给我证书中的一个错误。如果有人能帮我解决这个问题,我会非常感激的。
版
文件:/etc/nginx/sites现有/mydomain.com
# FORGE CONFIG (DO NOT REMOVE!)
#include forge-conf/todocontenidoweb.com/before/*;
server {
listen 443 ssl;
listen [::]:443 ssl;
include snippets/self-signed.conf;
include snippets/ssl-params.conf;
server_name todocontenidoweb.com www.todocontenidoweb.com;
server_tokens off;
root /home/forge/todocontenidoweb.com/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY13>
# ssl_prefer_server_ciphers off;
# ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
#include forge-conf/todocontenidoweb.com/server/*;
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; }
access_log off;
error_log /var/log/nginx/todocontenidoweb.com-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
server {
listen 80;
listen [::]:80;
server_name todocontenidoweb.com www.todocontenidoweb.com;
return 302 https://$server_name$request_uri;
}
# FORGE CONFIG (DO NOT REMOVE!)
#include forge-conf/todocontenidoweb.com/after/*;
发布于 2022-05-04 07:38:00
//编辑
如下所示,该站点将返回301响应并重定向到https站点,但您的nginx信任没有一个在端口443上运行。
//编辑结束
您的nginx配置似乎有问题。看起来您的配置只允许端口80,而不是443。浏览器期望将443作为端口(除非您另外指定)作为ssl端口。似乎您正在使用一些重定向将用户从http重定向到https,唯一的问题是您没有在端口443上运行任何https服务。
我可能是你的nginx配置的问题。确保具有ssl输入的server
条目也运行在端口443上。
如果您安装了ssl,让我们加密,您可以尝试手动生成证书,然后您可以修改nginx 配置以ssl形式在端口443上运行。
您可以从数字海洋跟踪本指南,只需将证书路径替换为lets encrypt one即可。
编辑2:
我认为这部分不应该被删掉
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY13>
# ssl_prefer_server_ciphers off;
# ssl_dhparam /etc/nginx/dhparams.pem;
因为您实际上没有通过443端口提供任何ssl证书。
下面是来自DigitalOcean的一个示例服务器。如你所见,他们提供的是私钥和公钥。生成证书后,需要输入这些证书的路径。
server {
listen 443 http2 ssl;
listen [::]:443 http2 ssl;
server_name your_server_ip;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
}
编辑结束
https://stackoverflow.com/questions/72108003
复制相似问题