如何配置https加密请求?

1、在各大域名厂商官网下载证书。

2、设置nginx的https。

配置案例如下:

http {
    server {
        listen 443 ssl;
        server_name www.ljj520.cn;
        root /var/www/www.ljj520.cn;
        index index.html index.html;
	    ssl_certificate /etc/ssl/1_ljj520.cn_bundle.crt;
	    ssl_certificate_key /etc/ssl/2_ljj520.cn.key;
	    ssl_session_timeout 5m;
	    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
	    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	    ssl_prefer_server_ciphers on;
	
       location / {
	    index index.html index.htm;
	   }

    }

    server {
        listen 80;
        server_name www.ljj520.cn;
	rewrite ^(.*)$ https://$host$1 permanent;
    }
}


 

你可能感兴趣的:(Linux)