太虚伪了 发表于 2014-6-6 15:44:58

伪静态头疼死我了

虚拟主机的配置文件server
{

listen 80;

#listen [::]:80;

server_name new.ewdai.com;

root /home/www/ewdai.com;

index index.html index.htm index.php default.html default.htm default.php;

#error_page   404   /404.html;

include my.conf;

location ~ [^/]\.php(/|$)

{

# comment try_files $uri =404; to enable pathinfo

try_files $uri =404;

fastcgi_passunix:/tmp/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf;

#include pathinfo.conf;

}



location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

}



location ~ .*\.(js|css)?$

{

expires      12h;

}



access_log off;

}
自定义的重写规则文件my.conf
location / {



rewrite
^(.*)/user/(.*)/(.*)/(.*)/(.*)$ $1/index\.php?user&user_id=$2&q=code/$3/$4&a=$5 last;

rewrite
^(.*)/user/(.*)/(.*)/(.*)$ $1/index\.php?user&user_id=$2&q=code/$3/$4 last;

rewrite
^(.*)/user/(.*)/(.*)$ $1/index\.php?user&user_id=$2&q=code/$3 last;

rewrite
^(.*)/user/(.*)$ $1/index\.php?user&user_id=$2 last;

rewrite
^(.*)/u/(.*)/(.*)$ $1/index\.php?home&user_id=$2&q=$3 last;

rewrite
^(.*)/u/(.*)$ $1/index\.php?home&user_id=$2 last;

rewrite
^(.*)/(.*)/(.*)/index.html$ $1/index\.php?$2&nid=$3 last;

rewrite
^(.*)/(.*)/(.*)/index(.*).html$ $1/index\.php?$2&nid=$3&page=$4 last;

rewrite
^(.*)/(.*)/(.*)/a(.*).html$ $1/index\.php?$2&nid=$3&article_id=$4 last;

rewrite
^(.*)/(.*)/index.html$ $1/index\.php?$2 last;

rewrite
^(.*)/(.*)/index(.*).html$ $1/index\.php?$2&page=$3 last;

rewrite
^(.*)/(.*)/a(.*)_(.*).html$ $1/index\.php?$2&article_id=$3&page=$4 last;

rewrite
^(.*)/(.*)/a(.*).html$ $1/index\.php?$2&article_id=$3 last;



}

为什么不生效~但是确实加载了这个文件,因为这个文件有错误,nginx会重启失败~求助啊~~~~~~~~~

太虚伪了 发表于 2014-6-6 16:31:11

这个网站急着上线,如果这个伪静态过不去的话,我只能考虑把ngnix换成apache了,我用的的是lnmp1.1,请问军歌,如果要换成apache,需要怎么操作,我是个linux菜鸟,还请尽量详细点~感激不尽。。

licess 发表于 2014-6-6 17:07:55

location ~ [^/]\.php(/|$) 换成location ~ .*\.(php|php5)?$试试

太虚伪了 发表于 2014-6-6 17:13:28

原帖由 licess 于 2014-6-6 17:07 发表 https://bbs.vpser.net/images/common/back.gif
location ~ [^/]\.php(/|$) 换成location ~ .*\.(php|php5)?$试试 不管用~:(:Q:Q

licess 发表于 2014-6-6 17:34:23

伪静态是官网提供的还是程序转换出来的?

太虚伪了 发表于 2014-6-6 21:40:52

程序开发公司给的~~~~~~~

licess 发表于 2014-6-7 16:54:25

可能伪静态有问题
页: [1]
查看完整版本: 伪静态头疼死我了