环境:LNMP一键安装包1.3版本
伪静态规则文件需要放在/usr/local/nginx/conf/ 下面。
创建一个phpcms.conf文件,里面写如下伪静态规则:location / {
if (!-e $request_filename){
rewrite ^/caipu-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 last;
rewrite ^/content-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 last;
rewrite ^/list-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=lists&catid=$1&page=$2 last;
rewrite ^/tag-([^\.]*)-([0-9]+)-([0-9]+).html /index.php?m=content&c=tag&catid=$2&tag=$1&page=$3 last;
rewrite ^/comment-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=comment&c=index&a=init&commentid=content_$1-$2-$3 last;
rewrite ^/([^\.]*).html /index.php?m=member&c=index&a=$1 last;
}
}
将伪静态导入到主机配置文件。
虚拟主机配置文件在:/usr/local/nginx/conf/vhost/域名.conf
打开后,在root /home/wwwroot/域名;这一行下面添加:include phpcms.conf;
执行:/etc/init.d/nginx restart 重启生效。