我想我错过了一些简单的东西,但我就是看不见。
我正在一台运行Ubuntu20.04版本2的家用机器上运行最新的Nginx,我的路由器/防火墙运行在另一台机器上。我已经设置了一个DDNS (.ddns.net)条目来指向我不断变化的广域网IP地址。
我有一个域名".net“。我已经能够为我的Ubuntu/Nginx机器上的两个域创建一个让我们加密的证书:.net和.ddns.net。
我在承载我的域的站点上创建了一个CNAME记录映射"www“到".ddns.net”。
当我访问https://[my_[名称].ddns.net时,这个网站就完美地出现了。
当我访问https://www.[my_[名称].net时,网站会给出一个证书警告,因为它正在为https://[my_[名称].ddns.net提取证书。
www..net网站的nginx配置是:
server {
listen 80;
root /var/www/html;
index index.html
server_name www.[my_name].net;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
server {
root /var/www/html;
index index.html
server_name www.[my_name].net;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/www.[my_name].net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.[my_name].net/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}要让What“看到”重定向的URL为www..net而不是.ddns.net,我必须做什么?
谢谢一堆。
发布于 2021-03-10 02:53:53
您需要创建包含所有名称的“让我们加密证书”。
https://serverfault.com/questions/1056505
复制相似问题