ubu*_*god 3 https nginx digital-ocean lets-encrypt
我按照以下教程在 DigitalOcean 上为我的网站设置 https:https ://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16- 04
但是,我被困在了这个地方 - 第 6 步 - 使用 TLS 保护您的应用程序
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
Run Code Online (Sandbox Code Playgroud)
ssl-*.conf我的snippets文件夹中没有匹配上述TLS conf文件中的行。到目前为止,我没有看到任何其他错误。我可以使用 Http 查看我的网站,但不能使用 HTTPS。
该命令sudo nginx -t产生:
nginx: [emerg] open() "/etc/nginx/snippets/ssl-example.com.conf" failed (2: No such file or directory) in /etc/nginx/sites-enabled/example.com:13
Run Code Online (Sandbox Code Playgroud)
是的,这些文件不存在。所以,我猜本教程跳过了生成这些文件的步骤。
该命令ls /etc/nginx/snippets产生:
fastcgi-php.conf
snakeoil.conf
Run Code Online (Sandbox Code Playgroud)
显然ssl-*.conf文件丢失了。
请帮忙。我尝试向 DigitalOcean 社区寻求帮助,但没有得到任何帮助。
提前致谢。
好的,经过一段时间的研究后,我自己找到了解决方案。
我们必须自己创建这些文件(配置片段)。
我们首先创建配置片段文件:
sudo vim /etc/nginx/snippets/ssl-example.com.conf
Run Code Online (Sandbox Code Playgroud)
然后我们在这个文件中添加我们的 SSL 密钥和证书位置:
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)
现在,我们在创建后将加密设置添加到第二个片段文件中:
sudo vim /etc/nginx/snippets/ssl-params.conf
Run Code Online (Sandbox Code Playgroud)
可以通过此链接轻松添加该设置。
保存此文件后,我们要做的就是修改 Nginx 配置文件。
| 归档时间: |
|
| 查看次数: |
2908 次 |
| 最近记录: |