官术网_书友最值得收藏!

  • NGINX Cookbook
  • Tim Butler
  • 119字
  • 2021-07-03 00:04:33

How to do it...

Now that we have a certificate and private key, we can update our NGINX configuration to serve SSL-based sites. Here's our NGINX server directive block:

server { 
    listen              443 ssl; 
    server_name         ssl.nginxcookbook.com; 
    ssl_certificate     /etc/ssl/public.pem; 
    ssl_certificate_key /etc/ssl/private.key; 
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2; 
    ssl_ciphers         HIGH:!aNULL:!MD5; 
 
    access_log  /var/log/nginx/ssl-access.log  combined; 
 
    location  /favicon.ico { access_log off; log_not_found off; } 
    root  /var/www; 
} 

If you have a basic index.html or similar in /var/www, you should see something like the following:

The error message will vary between browsers, but they're all simply letting you know that the certificate presented couldn't be validated and therefore can't be intrinsically trusted. For testing, add an exception here; you should see the SSL site served by NGINX:

主站蜘蛛池模板: 南开区| 南开区| 乐至县| 长治县| 麻江县| 汉寿县| 汪清县| 安多县| 南乐县| 屯留县| 京山县| 方正县| 遵义市| 嵊州市| 普兰县| 佳木斯市| 东阳市| 资源县| 双辽市| 比如县| 南皮县| 东源县| 昆明市| 黎城县| 德清县| 鹿邑县| 旌德县| 老河口市| 张家口市| 嵊泗县| 会昌县| 黄梅县| 武陟县| 马龙县| 武宁县| 壤塘县| 汉川市| 上虞市| 乌审旗| 秭归县| 五大连池市|