nginx+ssl配置https網絡協議

配置https server 443


    server {
       listen       443 ssl;
        server_name  你的域名;
		
		//控制時候訪問目錄所有文件
		root    html/regiest;
	    index  index.html; 

       ssl_certificate      cert/申請的ssl.pem;
       ssl_certificate_key  cert/申請的ssl.key;

       ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

       ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            root   html/regiest;  //項目路徑
            index  index.html index.htm;  //入口文件
        }
		
    }

訪問http自動跳轉https

	server {
            listen       80;
            server_name 你的域名;
			#rewrite ^(.*)$ https://$host$1 permanent;
			return  301 https://你的域名$request_uri;
   }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章