Vik*_*han 6 encryption ssl nginx ubuntu-14.04 lets-encrypt
我有一个NGINX服务器,我试图使用Let的加密添加SSL.
我的开发设置如下:
url : dev.domain.in
root: /var/www/dev/html
Run Code Online (Sandbox Code Playgroud)
制作如下:
url : domain.in
root: /var/www/production/html
Run Code Online (Sandbox Code Playgroud)
所以在我的nginx默认页面中,我有两个服务器块,一个用于开发,另一个用于生产
我想为两台服务器提供一个证书.
我知道根据Let's Encrypt网站的命令如下
cd/opt/letsencrypt ./letsencrypt-auto certonly -a webroot --webroot-path =/usr/share/nginx/html -d example.com -d www.example.com
但是,只有当SUBDOMAIN具有相同的webroot且在我的情况下不是真的时才能这样做.
那么我如何在这里添加CERT
请帮帮我
Sim*_*pel 10
我在我的nginx盒子上的所有虚拟主机上使用了一个通用的webroot.
/opt/certbot/certbot-auto certonly --webroot --agree-tos -w /srv/www/letsencrypt/ \
-d example.com,www.example.com
Run Code Online (Sandbox Code Playgroud)
...在nginx中我有snippets/letsencrypt.conf:
location ~ /.well-known {
root /srv/www/letsencrypt;
allow all;
}
Run Code Online (Sandbox Code Playgroud)
...包含在每个站点的服务器块中.
.well-known目录中的文件是临时的 - 它们只存在足够长的时间以完成授权过程,然后被删除.
注册成功后,我将证书定义包含在服务器块中include ssl/example.com.conf;,该文件包含以下内容:
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
Run Code Online (Sandbox Code Playgroud)
...以及相关的listen指令以在端口443上启用SSL.
您可以在多个服务器块中包含相同的定义.
我的证书中还有其他子域作为SAN,我有单独的服务器块example.com,www.example.com以及其他子域,例如click.example.com- 所有使用相同的证书.
Let\xc2\xb4s 加密 Webroot 方法使用 Webroot 目录中名为“.well-known/acme-challenge”的文件。您可以在开发和主服务器上配置一个位置片段,以指向该文件的另一个 Webroot。
\n\n就像是:
\n\n location /.well-known/acme-challenge {\n alias /etc/letsencrypt/webrootauth/.well-known/acme-challenge;\n location ~ /.well-known/acme-challenge/(.*) {\n add_header Content-Type application/jose+json;\n }\n }\nRun Code Online (Sandbox Code Playgroud)\n\n并将您的网络根目录指向--webroot-path /etc/letsencrypt/webrootauth
这个讨论可以帮助
\n\n或者您可以使用独立方法并手动完成一些工作。
\n| 归档时间: |
|
| 查看次数: |
8416 次 |
| 最近记录: |