linux - Nginx 配置不起作用

标签 linux nginx dns debian webserver

我为我的域创建了几个子域,例如 api.example.com、dev.example.com 和 www.example.com。我在 Nginx 中为每个子域创建了一个虚拟主机。

但现在的问题是,当我访问一个不存在的域时,它应该被重定向到 www.example.com。但这不是存在的,而是我收到一个错误页面,指出子域没有安全连接。因为我使用的是 Let's Encrypt,所以我总是收到此错误的子域消息。我联系了我的 DNS 提供商,他们告诉我你的设置是正确的,你必须更正你的网络服务器配置。他们添加了 CNAME。

现在我不知道如何在我的 nginx 配置中添加它。

最佳答案

所以...您在浏览器中输入了 https://incorrect.example.com? 如果是这样,我认为问题无法解决。 他们在文章 ( https://community.letsencrypt.org/t/can-i-use-letsencrypt-in-more-than-one-subdomain/16588/8) 中说

Let's Encrypt does not currently offer "wildcard" certificates. So you will need to be able to list all the domains you want a certificate for, you can't (as you can with some of the pricier paid certificates) get just one that works for every possible name in your domain. With Let's Encrypt you'd need to issue new certificates for any new names you needed.

这表明你不能设置所有不正确的子域的证书...

但是如果你只输入“http://incorrect.example.com”,它可以成功重定向,没有错误页面。 如果错误页面继续出现,请发布您的 nginx 配置。

关于linux - Nginx 配置不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45547651/

相关文章:

c++ - Linux:检查进程是否具有对 C/C++ 文件的读取权限

file - Nginx 服务静态大文件

Golang接口(interface)的正确使用

azure - 如何在 Azure 中的 ubuntu 中启用互联网连接

c - execvpe 的可移植替代品

c++ - linux aes256 带 cbc 加密/解密库

excel - 在 linux 中创建一个 *.xlsb

node.js - 需要有关 Nodejs api 的 nginx 配置的帮助

Nginx——从redis中读取值并将其存储到变量中

linux - 设置 bind9 DNS 正向查找