「HTTPS」 Tips
什么是HTTPS
申请免费SSL
Nginx 部署设置https
vi /etc/nginx/nginx.conf
1 server {
2 listen 443 ssl http2 default_server;
3 listen [::]:443 ssl http2 default_server;
4 server_name www.bytegopher.com; # bind the domain name
5 root /var/www/hexo;
6 index index.html index.htm;
7
8 ssl_certificate /etc/nginx/bytegopher.com/bytegopher.com.crt; # absolute path of certificate
9 ssl_certificate_key /etc/nginx/bytegopher.com/bytegopher.com.key; # absolute path of certificate
10 ssl_session_timeout 5m;
11 ssl_protocols TLSv1.1 TLSv1.2;
12 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
13 ssl_prefer_server_ciphers on;
14
15 # Load configuration files for the default server block.
16 include /etc/nginx/default.d/*.conf;
17
18
19 error_page 404 /404.html;
20 location = /40x.html {
21 }
22
23 error_page 500 502 503 504 /50x.html;
24 location = /50x.html {
25 }
26 }
27
28 # 如果是http请求则自动转换为https
29 server {
30 listen 80;
31 server_name www.bytegopher.com;
32 rewrite ^(.*) https://$server_name$1 permanent;
33 }
SSL 状态检测
如何查看一个网站的非https请求
chrome 调试模式的console 中会输出非https请求