代码如下

server
{
listen 80;
server_name eqblog.com www.eqblog.com; //修改成自己的域名
rewrite ^/(.*) https://eqblog.com/$1 permanent; //修改成自己的域名
}
server {
listen 443;
server_name eqblog.com www.eqblog.com; //修改成自己的域名
access_log /home/wwwlogs/eqblog.com_nginx.log combined;
index index.html index.htm index.php;
include wordpress.conf;
root /home/wwwroot/eqblog.com; //改成自己的网站路径
ssl on;
ssl_certificate /root/crt.crt;
ssl_certificate_key /root/key.key;
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {
valid_referers none blocked *.eqblog.com eqblog.com www.eqblog.com;
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;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}