以下为Nginx 1.3 SSL网站使用的配置文件.
server {
listen 443 ssl spdy; #编译时必须打开SPDY, NGINX版本 1.3+
server_name example.com;
index index.html index.htm index.php;
root /home/wwwroot/example;
ssl on; #打开SSL
ssl_certificate certs/example.crt; #设置证书
ssl_certificate_key certs/example.key; #设置KEY文件
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; #只打开SSLV3 和TLSV1,V1.1,V1.2,不打开老的SSLV2
ssl_prefer_server_ciphers on;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache builtin:1000 shared:SSL:10m; #SSL会话缓存加速
spdy_headers_comp 5;
location ~ .*\.(php|php5)?$ {
include php.conf;
}
}
server { #这里是自动跳转到SSL的部分.
listen 80;
server_name example.com www.example.com;
rewrite ^/(.*) https://example.com/\ permanent;
}
感觉好复杂呀
谢谢博主了,方法很有效!测试通过!