无法在Ubuntu 16.04上使用自签名证书Nginx

时间:2019-05-17 11:09:01

标签: nginx server ssl-certificate

在Nginx服务器上不起作用的自签名ssl证书。

这是/etc/nginx/nginx.conf

user fatboy;
http {
  default_type application/octet-stream;
  include      /etc/nginx/mime.types;
  server {
     location / {
       proxy_pass http://localhost:8080/;
     }
  }
  server{
     listen 443;
     ssl on;
     ssl_certificate /home/fatboy/public.pem;
     ssl_certificate_key /home/fatboy/key.pem;
     location / {
       proxy_pass http://localhost:8080/;
       }
  }
}
worker_processes 5;
events {
  worker_connections 2000;
}

这是sudo ufw状态:

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
443                        DENY        Anywhere
Nginx Full                 ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
443 (v6)                   DENY        Anywhere (v6)
Nginx Full (v6)            ALLOW       Anywhere (v6)

对于自签名证书,我使用了以下命令:

openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out public.pem -subj "/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=www.bux-bot.ru"

1 个答案:

答案 0 :(得分:0)

因此,在您的情况下,防火墙阻止了端口443。

您可以打开运行sudo ufw allow 443的端口并检查状态sudo ufw status

现在打开https://bux-bot.ru/

相关问题