最近有童鞋问道在LNMP的环境中,怎么设置Wordpress的配置文件,现在我给一个模版:
- server {
- listen 80;
- server_name www.luxiaok.com;
- root /var/www/wordpress;
- index index.php index.html;
- # log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- # '$status $body_bytes_sent "$http_referer" '
- # '"$http_user_agent" "$http_x_forwarded_for"';
- # access_log logs/access.log main;
- 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都可以使用。
转载于:https://blog.51cto.com/luxiaok/1056668