全球主机交流论坛
标题:
向大家求助:这个Nginx伪静态规则该怎么才能让它生效?
[打印本页]
作者:
肥鱼
时间:
2012-4-30 15:20
标题:
向大家求助:这个Nginx伪静态规则该怎么才能让它生效?
本帖最后由 肥鱼 于 2012-4-30 15:30 编辑
已经解决了
谢谢大家!!!!
使用http://lnmp.org/安装的Nginx/php/mysql
程序自带有一个伪原创的Nginx规则
但是我不知道该怎么配置
请大家帮我看一下吧
我把这个规则在/usr/local/nginx/conf/下建立xxx.conf
然后在vhost目录下的虚拟主机配置文件中include这个xxx.conf
出现了这样的错误:
nginxnginx: [emerg] location "/" is outside location ".*\.(php|php5)?$" in /usr/local/nginx/conf/fltang.conf:1
复制代码
Nginx伪静态配置规则如下
location / {
rewrite ^/index\.html$ /index.php last;
rewrite ^/sitemap\.html$ /sitemap.php last;
rewrite ^/userbao-(.*)-(.*)-(.*)-(.*)\.html$ /userbao.php?id=$1&catid=$2&xs=$3&page=$4 last;
rewrite ^/userbao-(.*)\.html$ /userbao.php?id=$1 last;
rewrite ^/baobeilist\.html$ /baobeilist.php last;
rewrite ^/baobeilist-(.*)-(.*)-(.*)-(.*)\.html$ /baobeilist.php?catid=$1&sort=$2&key=$3&page=$4 last;
rewrite ^/baobei-(.*)-(.*)\.html$ /baobei.php?id=$1&page=$2 last;
rewrite ^/baobei-(.*)\.html$ /baobei.php?id=$1 last;
rewrite ^/malllist\.html$ /malllist.php last;
rewrite ^/shoplist\.html$ /shoplist.php last;
rewrite ^/article\.html$ /article.php last;
rewrite ^/user/center\.html$ /user/center.php last;
rewrite ^/mall-(.*)-(.*)-(.*)\.html$ /mall.php?id=$1&act=$2&page=$3 last;
rewrite ^/mall-(.*)-(.*)\.html$ /mall.php?id=$1&act=$2 last;
rewrite ^/mall-(.*)\.html$ /mall.php?id=$1 last;
rewrite ^/view-(.*)-(.*)\.html$ /view.php?iid=$1&page=$2 last;
rewrite ^/view-(.*)\.html$ /view.php?iid=$1 last;
rewrite ^/malllist-(.*)-(.*)-(.*)\.html$ /malllist.php?catid=$1&mall=$2&page=$3 last;
rewrite ^/article_list-(.*)-(.*)\.html$ /article_list.php?cid=$1&page=$2 last;
rewrite ^/article_list-(.*)\.html$ /article_list.php?cid=$1 last;
rewrite ^/read-(.*)\.html$ /read.php?id=$1 last;
rewrite ^/shoplist-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /shoplist.php?cid=$1&keyword=$2&start_level=$3&end_level=$4&area=$5&px=$6&cpr=$7&type=$8&page=$9 last;
rewrite ^/list-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /list.php?cid=$1&start_price=$2&end_price=$3&sort=$4&area=$5&guarantee=$6&list=$7&q=$8&page=$9 last;
rewrite ^/shop-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /shop.php?nick=$1&start_price=$2&end_price=$3&sort=$4&area=$5&guarantee=$6&list=$7&q=$8&page=$9 last;
rewrite ^/shoplist-(.*)\.html$ /shoplist.php?cid=$1 last;
rewrite ^/shop-(.*)\.html$ /shop.php?nick=$1 last;
rewrite ^/list-(.*)\.html$ /list.php?cid=$1 last;
rewrite ^/tgimg/(.*)\.jpg$ /topic.php?pic=$1 last;
rewrite ^/list\.html$ /list.php last;
rewrite ^/huangou-(.*)\.html$ /huangou.php?id=$1 last;
rewrite ^/huan-(.*)-(.*)\.html$ /huan.php?keyword=$1&page=$2 last;
rewrite ^/huan\.html$ /huan.php last;
rewrite ^/coupons-(.*)-(.*)\.html$ /coupons.php?cid=$1&page=$2 last;
rewrite ^/coupons\.html$ /coupons.php last;
rewrite ^/cuxiao-(.*)\.html$ /cuxiao.php?id=$1 last;
rewrite ^/tg-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /tg.php?city_id=$1&catid=$2&mallid=$3&keyword=$4&page=$5 last;
rewrite ^/tg-(.*)-(.*)-(.*)-(.*)\.html$ /tg.php\?city_id=$1&catid=$2&mallid=$3&page=$4 last;
rewrite ^/tg-(.*)-(.*)-(.*)\.html$ /tg.php?city_id=$1&catid=$2&mallid=$3 last;
rewrite ^/tg-(.*)\.html$ /tg.php?city_id=$1 last;
rewrite ^/tg\.html$ /tg.php last;
rewrite ^/tgview-(.*)\.html$ /tgview.php?id=$1 last;
}
复制代码
作者:
cnweb
时间:
2012-4-30 15:20
太难了
作者:
肥鱼
时间:
2012-4-30 15:22
cnweb 发表于 2012-4-30 15:20
太难了
我不懂这个Nginx的配置。。。。。
头都快想破了。。。
希望懂技术的朋友帮我看一下
不胜感激!!!
作者:
fatppmm
时间:
2012-4-30 15:24
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 全球主机交流论坛 (https://loc.888543.xyz/)
Powered by Discuz! X3.4