以下没有出错,但是会影响到其它站点~~~我晕了。。。
server {
listen 80;
server_name www.skiy.net skiy.net;
#rewrite ^/(.*) https://$server_name$1 permanent;
return 301 https://$server_name$request_uri;
}
server {
access_log off;
index index.html index.htm index.jsp index.php;
include rewrite/typecho.conf;
root /home/wwwroot/www.skiy.net;
#error_page 404 /404.html;
if ( $query_string ~* ".*[\;‘\<\>].*" ){
return 404;
}
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {
valid_referers none blocked *.skiy.net www.skiy.net skiy.net;
if ($invalid_referer) {
#rewrite ^/ http://www.linuxeye.com/403.html;
return 403;
}
}
location ~ .*\.(php|php5)?$ {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 7d;
}
#https
listen 443;
server_name www.skiy.net skiy.net;
ssl on;
ssl_certificate /usr/local/nginx/conf/keyssh/1_www.skiy.net_bundle.crt;
ssl_certificate_key /usr/local/nginx/conf/keyssh/2_www.skiy.net.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;
ssl_prefer_server_ciphers on;
error_page 497 "https://$host$uri?$args"; #http To https
}
原文:http://my.oschina.net/skiycn/blog/422271