Nginx是一个小巧而高效的Linux下的Web服务器软件,是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,已经在一些俄罗斯的大型网站上运行多年,目前很多国内外的门户网站、行业网站也都在是使用Nginx,相当的稳定。
Nginx相当的稳定、功能丰富、安装配置简单、低消耗系统、内存资源。。。。(配置不当很容易出现502,特别是在php5.2版本上,php5.3忽略...)
首先打开主机配置文件:/usr/local/nginx/conf/vhost/域名.conf,打开后前半部分
server { listen 80; #listen [::]:80; server_name 1080kan.com; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/1080kan.com/www.1080kan.com; include hadsky.conf; #error_page 404 /404.html; location ~ [^/]\.php(/|$) {################################################
在root /home/wwwroot/1080kan.com/www.1080kan.com;
这一行的下面添加include hadsky.conf; 上面的hadsky.conf;为伪静态文件,修改后保存并上传覆盖。(记得备份域名.conf)
本地创建一个hadsky.conf格式的文件,把下面的伪静态规则写入保存后上传到/usr/local/nginx/conf/ 下面
执行:/etc/init.d/nginx restart 重启生效
附上Nginx伪静态规则:
location / { rewrite ^/list-([0-9]+)-([0-9]+)\.html$ /index\.php\?c=list&sortid=$1&page=$2; rewrite ^/list-high-([0-9]+)-([0-9]+)\.html$ /index\.php\?c=list&type=high&sortid=$1&page=$2; rewrite ^/user-([0-9]+).html$ /index\.php\?c=user&id=$1; rewrite ^/forum-([0-9]+).html$ /index\.php\?c=forum&id=$1; rewrite ^/user-([0-9]+)-([0-9]+).html$ /index\.php\?c=user&id=$1&page=$2; rewrite ^/app-([0-9a-zA-Z_]+)-([0-9a-zA-Z_]+)\.html$ /index\.php?c=app&a=$1:$2; rewrite ^/read-([0-9]+)-([0-9]+)\.html$ /index\.php\?c=read&id=$1&page=$2; rewrite ^/([0-9a-zA-Z_]+)\.html$ /index\.php\?c=$1; }
后台SEO开启伪静态。(由1080kan.com站长协助hadsky出品,转载请注明来源)
PS:伪静态功能仅对游客起作用。