docker - 如何从 ngnix.conf 文件中解决基本 URL 中的 www 问题
问题描述
我的 ngnix.conf 文件如下所示.. 我试图在浏览器中点击www.example.com,然后 url 被点击就像https://www.www.example.com// 这给了我 en错误。网址https://example.com也不起作用。
server {
#server_names_hash_bucket_size 64;
listen 80;
server_name *.example.com www.example.com example.com;
server_tokens off;
# Redirects http to https
location / {
#return 301 https://$host$request_uri;
#non www to www
rewrite ^(.*) https://www.$host$request_uri$1 permanent;
}
错误就像 -
您的连接不是私密的 攻击者可能试图从 example.com 窃取您的信息(例如,密码、消息或信用卡)。了解更多NET::ERR_CERT_COMMON_NAME_INVALID
注意 - 我的证书还没有过期..
解决方案
我有一个答案。
我以前生成过证书,例如-
sudo certbot certonly --manual \
--preferred-challenges=dns \
--email asdf@example.com \
--server https://acme-v02.api.letsencrypt.org/directory \
--agree-tos \
--manual-public-ip-logging-ok \
-d *.example.com \
现在我已经改变了我的证书生成过程,如下所示 -
sudo certbot certonly --manual \
--preferred-challenges=dns \
--email asdf@example.com \
--server https://acme-v02.api.letsencrypt.org/directory \
--agree-tos \
--manual-public-ip-logging-ok \
-d *.example.com \
-d example.com
这解决了我的问题。
推荐阅读
- mysql - django - 记录未保存在 MySQL 数据库中,但 AutoIncrement 增加
- c# - C# WPF 从 ListBox.selectedItem 接收的对象能够修改 itemSource 集合,如何?
- python - 在 Pandas 中计算每月的最后一个星期五
- c# - 命令优先于子模块组 Discord.Net
- sql-server - SQL Server:如何检测更新表/索引统计信息的适当时机
- nginx - 只允许一台主机使用入口 nginx configmap 进行连接
- c# - 动态获取一个 DbSet
按实体类名 - wordpress - 计算给定小部件的活动实例
- python - Python web-scraping 转到下一页
- azure - Azure AD - .Net Core 2 - 如何使用两个不同的客户端 ID?