全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 1988|回复: 3

[已解决] 向大家求助:这个Nginx伪静态规则该怎么才能让它生效?

[复制链接]
发表于 2012-4-30 15:20:03 | 显示全部楼层 |阅读模式
本帖最后由 肥鱼 于 2012-4-30 15:30 编辑

已经解决了
谢谢大家!!!!

使用http://lnmp.org/安装的Nginx/php/mysql
程序自带有一个伪原创的Nginx规则
但是我不知道该怎么配置
请大家帮我看一下吧
我把这个规则在/usr/local/nginx/conf/下建立xxx.conf
然后在vhost目录下的虚拟主机配置文件中include这个xxx.conf
出现了这样的错误:
  1. nginxnginx: [emerg] location "/" is outside location ".*\.(php|php5)?$" in /usr/local/nginx/conf/fltang.conf:1
复制代码
Nginx伪静态配置规则如下
  1. location / {       
  2. rewrite  ^/index\.html$ /index.php last;
  3. rewrite  ^/sitemap\.html$ /sitemap.php last;

  4. rewrite  ^/userbao-(.*)-(.*)-(.*)-(.*)\.html$ /userbao.php?id=$1&catid=$2&xs=$3&page=$4 last;
  5. rewrite  ^/userbao-(.*)\.html$ /userbao.php?id=$1 last;
  6. rewrite  ^/baobeilist\.html$ /baobeilist.php last;
  7. rewrite  ^/baobeilist-(.*)-(.*)-(.*)-(.*)\.html$ /baobeilist.php?catid=$1&sort=$2&key=$3&page=$4 last;
  8. rewrite  ^/baobei-(.*)-(.*)\.html$ /baobei.php?id=$1&page=$2 last;
  9. rewrite  ^/baobei-(.*)\.html$ /baobei.php?id=$1 last;

  10. rewrite  ^/malllist\.html$ /malllist.php last;
  11. rewrite  ^/shoplist\.html$ /shoplist.php last;
  12. rewrite  ^/article\.html$ /article.php last;
  13. rewrite  ^/user/center\.html$ /user/center.php last;
  14. rewrite  ^/mall-(.*)-(.*)-(.*)\.html$ /mall.php?id=$1&act=$2&page=$3 last;
  15. rewrite  ^/mall-(.*)-(.*)\.html$ /mall.php?id=$1&act=$2 last;
  16. rewrite  ^/mall-(.*)\.html$ /mall.php?id=$1 last;
  17. rewrite  ^/view-(.*)-(.*)\.html$ /view.php?iid=$1&page=$2 last;
  18. rewrite  ^/view-(.*)\.html$ /view.php?iid=$1 last;
  19. rewrite  ^/malllist-(.*)-(.*)-(.*)\.html$ /malllist.php?catid=$1&mall=$2&page=$3 last;
  20. rewrite  ^/article_list-(.*)-(.*)\.html$ /article_list.php?cid=$1&page=$2 last;
  21. rewrite  ^/article_list-(.*)\.html$ /article_list.php?cid=$1 last;
  22. rewrite  ^/read-(.*)\.html$ /read.php?id=$1 last;
  23. 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;
  24. 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;
  25. 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;
  26. rewrite  ^/shoplist-(.*)\.html$ /shoplist.php?cid=$1 last;
  27. rewrite  ^/shop-(.*)\.html$ /shop.php?nick=$1 last;
  28. rewrite  ^/list-(.*)\.html$ /list.php?cid=$1 last;
  29. rewrite  ^/tgimg/(.*)\.jpg$ /topic.php?pic=$1 last;
  30. rewrite  ^/list\.html$ /list.php last;
  31. rewrite  ^/huangou-(.*)\.html$ /huangou.php?id=$1 last;
  32. rewrite  ^/huan-(.*)-(.*)\.html$ /huan.php?keyword=$1&page=$2 last;
  33. rewrite  ^/huan\.html$ /huan.php last;
  34. rewrite  ^/coupons-(.*)-(.*)\.html$ /coupons.php?cid=$1&page=$2 last;
  35. rewrite  ^/coupons\.html$ /coupons.php last;
  36. rewrite  ^/cuxiao-(.*)\.html$ /cuxiao.php?id=$1 last;
  37. rewrite  ^/tg-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /tg.php?city_id=$1&catid=$2&mallid=$3&keyword=$4&page=$5 last;
  38. rewrite  ^/tg-(.*)-(.*)-(.*)-(.*)\.html$ /tg.php\?city_id=$1&catid=$2&mallid=$3&page=$4 last;
  39. rewrite  ^/tg-(.*)-(.*)-(.*)\.html$ /tg.php?city_id=$1&catid=$2&mallid=$3 last;
  40. rewrite  ^/tg-(.*)\.html$ /tg.php?city_id=$1 last;
  41. rewrite  ^/tg\.html$ /tg.php last;
  42. rewrite  ^/tgview-(.*)\.html$ /tgview.php?id=$1 last;
  43. }
复制代码
发表于 2012-4-30 15:20:37 | 显示全部楼层
太难了
 楼主| 发表于 2012-4-30 15:22:06 | 显示全部楼层
cnweb 发表于 2012-4-30 15:20
太难了

我不懂这个Nginx的配置。。。。。
头都快想破了。。。
希望懂技术的朋友帮我看一下
不胜感激!!!
发表于 2012-4-30 15:24:10 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-30 12:22 , Processed in 0.060781 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表