简体   繁体   English

在NGINX / Ubuntu 16.04 x64(Digital Ocean)上安装SSL证书

[英]Install SSL Certificate on NGINX / Ubuntu 16.04 x64 (Digital Ocean)

I have been trying to install the SSL certificate on my droplet on Digital Ocean. 我一直试图在Digital Ocean的我的Droplet上安装SSL证书。 This droplet is running NGINX / Ubuntu 16.04 x64. 这个小滴正在运行NGINX / Ubuntu 16.04 x64。

I don't have any cPanel just a terminal with SSH connection. 我没有任何cPanel只是具有SSH连接的终端。

I have also talked to the Digital Ocean's support guy and he shared 2 tutorials with me which I have tried. 我还与Digital Ocean的支持人员进行了交谈,他与我分享了我尝试过的2个教程。 But following those tutorials end up breaking my site. 但是遵循这些教程最终破坏了我的网站。

Tutorial 1 教程1

Tutorial 2 教程2

I have edit the /etc/nginx/nginx.conf and added the server block like this in http block: 我已经编辑了/etc/nginx/nginx.conf并在http块中添加了如下所示的服务器块:

server {
         listen 443 ssl;
         server_name www.example.com;
         ssl_certificate /home/user/example/www.example.com.crt;
         ssl_certificate_key /home/user/example/www.example.com.key;
}

What I'm doing wrong and what is the right way? 我做错了什么,正确的方法是什么?

I'm confused which file to edit. 我对要编辑的文件感到困惑。

I have: 我有:

1) /etc/ngix/ngix.conf 1)/etc/ngix/ngix.conf

2) /etc/nginx/sites-available/default 2)/ etc / nginx / sites-available / default

3) /etc/nginx/sites-available/defaultu 3)/ etc / nginx / sites-available / defaultu

4) /etc/nginx/sites-available/example.com 4)/etc/nginx/sites-available/example.com

5) /etc/nginx/sites-enabled/example.com 5)/etc/nginx/sites-enabled/example.com

Please I need help... 请我帮忙...

More info is needed as to where you are at. 需要有关您所在位置的更多信息。 Have you got the certificates onto the droplet yet? 您是否已将证书粘贴到小滴上? If not and you are using a Windows machine to connect via SSH to the droplet, then I would recommend downloading WinSCP as you can use that to transfer the certificates. 如果没有,并且您正在使用Windows计算机通过SSH连接到Droplet,那么我建议您下载WinSCP,因为您可以使用它来传输证书。 If you let me know how far you are, I can walk you through the process. 如果您让我知道您有多远,我可以指导您完成整个过程。 Also, you have no listen directives in your server blocks such as: 另外,服务器块中没有侦听指令,例如:

listen 443 ssl;
ssl_certificate /path to .crt or .pem file;
ssl_certificate_key /path to .key file;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM