最近有童鞋问道在LNMP的环境中,怎么设置Wordpress的配置文件,现在我给一个模版:

 
  
  1. server {  
  2.  
  3.         listen   80;  
  4.         server_name  www.luxiaok.com;  
  5.         root   /var/www/wordpress;  
  6.         index  index.php index.html;  
  7.  
  8.           #  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
  9.           #                    '$status $body_bytes_sent "$http_referer" '  
  10.           #                    '"$http_user_agent" "$http_x_forwarded_for"';  
  11.           #  access_log  logs/access.log  main;  
  12.  
  13.         location ~ .*\.(php|php5)  {  
  14.                  fastcgi_pass    127.0.0.1:9000;  
  15.                  fastcgi_index   index.php;  
  16.                  fastcgi_param   SCRIPT_NAME $fastcgi_script_name;  
  17.                  fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;  
  18.                  include         fastcgi_params;  
  19.              }  
  20.  
  21.       # 防盗链  
  22.       # location ~* \.(jpg|png|swf|flv)$  {  
  23.       #          valid_referers none blocked www.luxiaok.com ;  
  24.       #          if ($invalid_referer) {  
  25.       #          rewrite ^/ http://www.luxiaok.com/retrun.html;  
  26.       #          return 404;  
  27.       #           }  
  28.       #   }  
  29.  
  30.       # Rewrite规则设置   
  31.         if (!-e $request_filename)  {  
  32.             rewrite ^(.+)$ /index.php last;  
  33.           }  
  34.  
  35. }  
  36.  
  37. # 域名301跳转  
  38. #  
  39. #  server {  
  40. #      server_name luxiaok.com;  
  41. #      rewrite ^/(.*) http://www.luxiaok.com/$1 permanent;  
  42. #         }  
  43. #  
  44. # By Luxiaok (C) 2012 

网上有很多教程,也可以按他们的设置下。

这其实也是Nginx的一个通用的虚拟主机配置文件,装Discuz,Magento都可以使用。