Nginx Rewrite小白来提问了
搭建了LNMP0.5,也安装了wp。现在就是“固定链接”搞不定。看了很多教程说要修改nginx.conf文件,并且给出了需要添加的内容,但是都没有说应该添加在什么地方啊!
这如这个wp的:
[*]location / {
[*] index index.html index.php;
[*] if (-f $request_filename/index.html){
[*] rewrite (.*) $1/index.html break;
[*] }
[*] if (-f $request_filename/index.php){
[*] rewrite (.*) $1/index.php;
[*] }
[*] if (!-f $request_filename){
[*] rewrite (.*) /index.php;
[*] }
[*] }复制代码
不知道应该放在nginx.conf的什么地方啊~~
还有就是说可以include的形式插入,这个又是怎么弄得啊?
肯定各位大大指点一下吧!
static/image/smiley/yct/002.gif
原帖由 prety 于 2010-12-8 21:17 发表
https://www.hs2v.com/images/common/back.gif
军哥0.5自带WP的Rewrite文件 配置主机的时候忘记写的话 vi修改下 usr/local/nginx/conf/xxx.com.conf
我把自己的conf文件post上来,各位大大帮忙看看:[*]server
[*] {
[*] listen 74.63.248.217:80;
[*] listen :80;
[*] server_name 4sqbadges.info;
[*] index index.html index.htm index.php default.html default.htm default.php;
[*] root/home/wwwroot;
[*]
[*] include wordpress.conf;
[*] location ~ .*\.(php|php5)?$
[*] {
[*] fastcgi_passunix:/tmp/php-cgi.sock;
[*] fastcgi_index index.php;
[*] include fcgi.conf;
[*] }
[*]
[*] location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
[*] {
[*] expires 30d;
[*] }
[*]
[*] location ~ .*\.(js|css)?$
[*] {
[*] expires 12h;
[*] }
[*]
[*] log_format4sqbadges.info.log'$remote_addr - $remote_user [$time_local] $request '
[*] '$status $body_bytes_sent $http_referer '
[*] '$http_user_agent $http_x_forwarded_for';
[*] access_log/home/wwwlogs/4sqbadges.info.log.log4sqbadges.info.log;
[*] }复制代码另外,wordpress.conf文件需不需要也放到vhost这个文件夹里面来啊?我放进来了,但是还是404 在最后 } 的上一行补充上~ include wordpress.conf;
vhost的上一级目录
页:
[1]