Wordpress在Nginx中的rewrite规则
最近有童鞋问道在LNMP的环境中,怎么设置Wordpress的配置文件,现在我给一个模版:[*]server {
[*]
[*] listen 80;
[*] server_namewww.luxiaok.com;
[*] root /var/www/wordpress;
[*] indexindex.php index.html;
[*]
[*] #log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
[*] # '$status $body_bytes_sent "$http_referer" '
[*] # '"$http_user_agent" "$http_x_forwarded_for"';
[*] #access_loglogs/access.logmain;
[*]
[*] location ~ .*\.(php|php5){
[*] fastcgi_pass 127.0.0.1:9000;
[*] fastcgi_index index.php;
[*] fastcgi_param SCRIPT_NAME $fastcgi_script_name;
[*] fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
[*] include fastcgi_params;
[*] }
[*]
[*] # 防盗链
[*] # location ~* \.(jpg|png|swf|flv)${
[*] # valid_referers none blocked www.luxiaok.com ;
[*] # if ($invalid_referer) {
[*] # rewrite ^/ http://www.luxiaok.com/retrun.html;
[*] # return 404;
[*] # }
[*] # }
[*]
[*] # Rewrite规则设置
[*] if (!-e $request_filename){
[*] rewrite ^(.+)$ /index.php last;
[*] }
[*]
[*]}
[*]
[*]# 域名301跳转
[*]#
[*]#server {
[*]# server_name luxiaok.com;
[*]# rewrite ^/(.*) http://www.luxiaok.com/$1 permanent;
[*]# }
[*]#
[*]# By Luxiaok (C) 2012
网上有很多教程,也可以按他们的设置下。
这其实也是Nginx的一个通用的虚拟主机配置文件,装Discuz,Magento都可以使用。
页:
[1]