哪位大哥帮忙把这个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 编辑 ] ==高人吧,不会这个 nginx如果直接放进伪静态专用的conf
需要定义主机头 原帖由 360111697 于 2011-7-13 20:18 发表
https://www.hs2v.com/images/common/back.gif
nginx不支持.htaccess的 请问你把规则放在哪里了?
我知道啊,我是要加进nginx.conf里面啊,但是我按自动转换的加进去不能用。 原帖由 西门小三 于 2011-7-13 21:34 发表
https://www.hs2v.com/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;
[*] }
[*] }
[*]
[*]复制代码 看上去应该没问题,不懂,问高人。
static/image/smiley/yct/014.gif
static/image/smiley/yct/019.gif
小夜是砖家 转换的可以啊 原帖由 lemss 于 2011-7-13 22:42 发表
https://www.hs2v.com/images/common/back.gif
转换的可以啊
就是测试了不行,我测试了N遍,都是不生效,打开静态页面,全部404。 把规则单独做个文件放到nginx/conf里面
然后域名的conf文件include 123.conf就可以了
页:
[1]