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

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:

主站蜘蛛池模板: 平顺县| 家居| 满城县| 金溪县| 红河县| 九龙县| 盈江县| 深州市| 江都市| 育儿| 大方县| 万宁市| 阳信县| 铜鼓县| 尚义县| 武功县| 资源县| 滁州市| 金沙县| 凌海市| 昌吉市| 全南县| 彰武县| 龙山县| 达日县| 鄂伦春自治旗| 巴里| 永登县| 通城县| 武邑县| 北票市| 上高县| 邓州市| 屏边| 吕梁市| 静安区| 焦作市| 九龙坡区| 秦安县| 汽车| 长子县|