无法在Nginx服务器中使用LetsEncrypt设置HTTPS [英] Unable to set HTTPS using LetsEncrypt in Nginx server

查看:127
本文介绍了无法在Nginx服务器中使用LetsEncrypt设置HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照以下教程在DigitalOcean上为我的网站设置了https: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04

I followed the following tutorial to set https for my website on DigitalOcean: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04

但是,我被困在这个地方-步骤6 –使用TLS保护您的应用程序

But, I got stuck at this place - Step 6 — Securing your Application with TLS

include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;

我的摘录文件夹中没有ssl-*.conf来与上述conf文件中的TLS匹配.到目前为止,我还没有看到任何其他错误.我可以使用Http查看我的网站,但不能使用HTTPS.

There are no ssl-*.conf in my snippets folder to match the lines in the above conf file for TLS. I did not see any other errors up to this point. I can view my site with Http, but not 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

是的,这些文件不存在.因此,我想该教程跳过了生成那些文件的步骤.

Yes, those files aren't there. So, I guess the tutorial skipped the step that generated those files.

命令ls /etc/nginx/snippets产生:

fastcgi-php.conf
snakeoil.conf

很明显,缺少ssl-*.conf文件.

请帮助.我尝试向DigitalOcean社区寻求帮助,但没有得到任何帮助.

Please help. I tried the DigitalOcean community for help, but didn't receive any help.

谢谢.

推荐答案

好的,经过一段时间的研究,我自己找到了解决方案.

Ok, After researching about this for some time I found the solution myself.

我们必须自己创建这些文件(配置摘要).

We have to create those files(configuration snippets) ourselves.

我们首先创建配置代码段文件:

We first create the configuration snippet file:

sudo vim /etc/nginx/snippets/ssl-example.com.conf

然后,我们在此文件内添加SSL密钥和证书位置:

Then we add in our SSL key and certificate locations inside this file:

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

现在,我们将创建后的加密设置添加到第二个片段文件中:

Now, we add in the encryption settings to the second snippet file after creating it:

 sudo vim /etc/nginx/snippets/ssl-params.conf

可以通过以下链接轻松添加设置.

The setting can be easily added following this link.

保存此文件后,我们要做的就是修改Nginx配置文件.

Once this file is saved, all we have to do is modify the Nginx configuration file.

这篇关于无法在Nginx服务器中使用LetsEncrypt设置HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆