若是一站點既要80 http訪問,又要443https訪問。php
要讓https和http並存,不能在配置文件中使用ssl on,配置listen 443 ssl;html
實例nginx
serversession
{dom
listen 80;ide
listen 443 ssl;ui
server_name www.iamle.com;server
index index.html index.htm index.php;htm
root /home/wwwroot/www.iamle.com/;ip
#ssl on; 這裏要註釋掉
ssl_certificate /usr/local/nginx/conf/ssl/www_iamle_com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/www_iamle_com.key;
#如下配置省略
}
From:http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server
me:
#ssl on;
ssl_certificate ../cert/geo-wondershare.cn.crt;
ssl_certificate_key ../cert/geo-wondershare.cn.key;
ssl_session_timeout 5m;
ssl_ciphers "AES128+EECDH:AES128+EDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
#add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
#add_header X-Frame-Options DENY;
#add_header X-Content-Type-Options nosniff;
##ssl_session_tickets off; # Requires nginx >= 1.5.9
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7
#resolver $DNS-IP-1 $DNS-IP-2 valid=300s;
resolver_timeout 8s;