Nginx设置不可IP直接访问,不管是80端口还是443端口,在设置https时就会遇到证书问题,那么问题的关键是如何设置https证书为空。

Nginx设置https证书为空

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
server {
         listen         80 default_server;
         listen         [::]:80 default_server;
         listen 443 ssl default_server;
         listen [::]:443 ssl default_server;
 
         server_name _;
 
         set $empty "";
         ssl_ciphers aNULL;
         ssl_certificate data:$empty;
         ssl_certificate_key data:$empty;
 
         return 444;
 }