VPS侦探论坛

 找回密码
 注册
查看: 5029|回复: 2

nginx添加伪静态规则

[复制链接]
发表于 2012-5-28 16:43:34 | 显示全部楼层 |阅读模式

比如 我程序用的是 这个规则
不知道怎么添加到  主机中   
location / {
rewrite ^/vod-(.*)\.html$ /index.php?s=/Home-vod-$1 last;
rewrite ^/news-(.*)$ /index.php?s=/Home-news-$1 last;
rewrite ^special-(.*)$ /index.php?s=/Home-special-$1 last;
rewrite ^/tag-(.*)$ /index.php?s=/Home-tag-$1 last;
rewrite ^/gb-(.*)$ /index.php?s=/Home-gb-$1 last;
rewrite ^/cm-(.*)$ /index.php?s=/Home-cm-$1 last;
rewrite ^/map-(.*)$ /index.php?s=/Home-map-$1 last;
rewrite ^/my-(.*)$ /index.php?s=/Home-my-$1 last;
rewrite ^/Tpl/(.*)/Home/(.*).html$ /index.php last;
}
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-5-28 18:06:29 | 显示全部楼层


/root/vhost.sh 添加时按提示输入一个文件名,在吧伪静态加入到前面的那个文件里,重启就行了

会修改配置,知道放哪里的话就直接include 伪静态的文件就行了,也可以直接放到server { }段里
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-5-28 19:24:15 | 显示全部楼层

明白了谢谢
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-23 03:29 , Processed in 0.025758 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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