yohu 发表于 2011-7-13 19:34:16

哪位大哥帮忙把这个apache的伪静态转成nginx的

RewriteEngine On

RewriteRule ^(.*)list/(.+)_(.+)\.html$ $1/list\.php\?uid=$2&page=$3
RewriteRule ^(.*)list/(.+)\.html$ $1/list\.php\?uid=$2
RewriteRule ^(.*)content/(.+)\.html$ $1/content.php\?uid=$2我试了那个在线自动转换的网站,转了以后没用,哪位高人帮忙下,谢谢。


在线转换的结果        rewrite ^/(.*)list/(.+)_(.+)\.html$ /$1/list\.php\?uid=$2&page=$3;
        rewrite ^/(.*)list/(.+)\.html$ /$1/list\.php\?uid=$2;
        rewrite ^/(.*)content/(.+)\.html$ /$1/content.php\?uid=$2;

[ 本帖最后由 yohu 于 2011-7-13 19:36 编辑 ]

www4074 发表于 2011-7-13 20:05:21

==高人吧,不会这个

西门小三 发表于 2011-7-13 21:34:12

nginx如果直接放进伪静态专用的conf
需要定义主机头

yohu 发表于 2011-7-13 21:38:15

原帖由 360111697 于 2011-7-13 20:18 发表 http://d.168530.xyz/images/common/back.gif
nginx不支持.htaccess的 请问你把规则放在哪里了?

我知道啊,我是要加进nginx.conf里面啊,但是我按自动转换的加进去不能用。

yohu 发表于 2011-7-13 21:41:51

原帖由 西门小三 于 2011-7-13 21:34 发表 http://d.168530.xyz/images/common/back.gif
nginx如果直接放进伪静态专用的conf
需要定义主机头


主机头?是指绑定域名是吧?有啊,我配置原来都有,已经在用的了。我现在的配置,中间那段就是我加进去的伪静态规则,但是没用。server {
      listen 12.34.56.78:80;
      root /var/www/abc;
        index index.php index.html index.htm;
      server_name abc.com;

       location = / {

        rewrite ^(.*)list/(.+)_(.+)\.html$ $1/list\.php\?uid=$2&page=$3 last;
        rewrite ^(.*)list/(.+)\.html$ $1/list\.php\?uid=$2 last;
        rewrite ^(.*)content/(.+)\.html$ $1/content.php\?uid=$2 last;

       }


        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /var/www/abc$fastcgi_script_name;
                include fastcgi_params;
        }
       }

西门小三 发表于 2011-7-13 21:46:56

看上去应该没问题,不懂,问高人。yc014t

神马皆浮云 发表于 2011-7-13 21:47:16

yc019t 小夜是砖家

lemss 发表于 2011-7-13 22:42:28

转换的可以啊

yohu 发表于 2011-7-14 00:24:32

原帖由 lemss 于 2011-7-13 22:42 发表 http://d.168530.xyz/images/common/back.gif
转换的可以啊


就是测试了不行,我测试了N遍,都是不生效,打开静态页面,全部404。

dianso 发表于 2011-7-14 00:35:45

把规则单独做个文件放到nginx/conf里面

然后域名的conf文件include 123.conf就可以了
页: [1] 2
查看完整版本: 哪位大哥帮忙把这个apache的伪静态转成nginx的