7月26
WordPress-PHPCMS-ECSHOP-SHOPEX-Discuz 7+Bo-Blog的Nginx常用伪静态规则怎么写?

当我们从apache服务器转向Nginx服务器的时候,它们的伪静态规则就不一样了,所以你熟悉Nginx服务器的伪静态规则,自己写当然也好。但很多网友还是不太了解Nginx服务器的伪静态规则的,而如果你安装的是一些常用的程序,如WordPress,PHPCMS,ECSHOP,SHOPEX,Discuz 7,那伪静态规则就有现成的了。为方便各位站长,收集了这几个常用程序的伪静态规则。

WordPress伪静态规则
    location / {
            index index.html index.php;
            if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
            }
            if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
            }
            if (!-f $request_filename){
                rewrite (.*) /index.php;
            }
        }

PHPCMS伪静态规则
    location / {
    ###以下为PHPCMS 伪静态化rewrite规则
    rewrite ^(.*)show-([0-9]+)-([0-9]+)\.html$ $1/show.php?itemid=$2&page=$3;
    rewrite ^(.*)list-([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$2&page=$3;
    rewrite ^(.*)show-([0-9]+)\.html$ $1/show.php?specialid=$2;
    
    ####以下为PHPWind 伪静态化rewrite规则
    rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
    rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
     }

ECSHOP伪静态规则
    if (!-e $request_filename)
    {
    rewrite "^/index\.html" /index.php last;
    rewrite "^/category$" /index.php last;
    rewrite "^/feed-c([0-9]+)\.xml$” /feed.php?cat=$1 last;
    rewrite “^/feed-b([0-9]+)\.xml$” /feed.php?brand=$1 last;
    rewrite “^/feed\.xml$” /feed.php last;
    rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
    rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$” /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
    rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
    rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$” /category.php?id=$1&brand=$2&page=$3 last;
    rewrite “^/category-([0-9]+)-b([0-9]+)(.*)\.html$” /category.php?id=$1&brand=$2 last;
    rewrite “^/category-([0-9]+)(.*)\.html$” /category.php?id=$1 last;
    rewrite “^/goods-([0-9]+)(.*)\.html” /goods.php?id=$1 last;
    rewrite “^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
    rewrite “^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$” /article_cat.php?id=$1&page=$2 last;
    rewrite “^/article_cat-([0-9]+)(.*)\.html$” /article_cat.php?id=$1 last;
    rewrite “^/article-([0-9]+)(.*)\.html$” /article.php?id=$1 last;
    rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html” /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
    rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html” /brand.php?id=$1&cat=$2&page=$3 last;
    rewrite “^/brand-([0-9]+)-c([0-9]+)(.*)\.html” /brand.php?id=$1&cat=$2 last;
    rewrite “^/brand-([0-9]+)(.*)\.html” /brand.php?id=$1 last;
    rewrite “^/tag-(.*)\.html” /search.php?keywords=$1 last;
    rewrite “^/snatch-([0-9]+)\.html$” /snatch.php?id=$1 last;
    rewrite “^/group_buy-([0-9]+)\.html$” /group_buy.php?act=view&id=$1 last;
    rewrite “^/auction-([0-9]+)\.html$” /auction.php?act=view&id=$1 last;
    rewrite “^/exchange-id([0-9]+)(.*)\.html$” /exchange.php?id=$1&act=view last;
    rewrite “^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
    rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
    rewrite “^/exchange-([0-9]+)-([0-9]+)(.*)\.html$” /exchange.php?cat_id=$1&page=$2 last;
    rewrite “^/exchange-([0-9]+)(.*)\.html$” /exchange.php?cat_id=$1 last;
    }

SHOPEX伪静态规则
    location / {
    if (!-e $request_filename) {
    rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
             }
    }

Discuz 7伪静态规则
    rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
    rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
    rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page\%3D$3&page=$2 last;
    rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
    rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;

Bo-Blog伪静态规则
   if (!-e $request_filename)
   {
      rewrite ^/post/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /read.php?entryid=$1&page=$2&part=$3 last;
      rewrite ^/page/([0-9]+)/([0-9]+)/?$ /index.php?mode=$1&page=$2 last;
      rewrite ^/starred/([0-9]+)/?([0-9]+)?/?$ /star.php?mode=$1&page=$2 last;
      rewrite ^/category/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ /index.php?go=category_$1&mode=$2&page=$3 last;
      rewrite ^/archiver/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /index.php?go=archive&cm=$1&cy=$2&mode=$3&page=$4 last;
      rewrite ^/date/([0-9]+)/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /index.php?go=showday_$1-$2-$3&mode=$4&page=$5 last;
      rewrite ^/user/([0-9]+)/?$ /view.php?go=user_$1 last;
      rewrite ^/tags/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ /tag.php?tag=$1&mode=$2&page=$3 last;
      rewrite ^/component/id/([0-9]+)/?$ /page.php?pageid=$1 last;
      rewrite ^/component/([^/]+)/?$ /page.php?pagealias=$1 last;

      #Force redirection for old rules
      rewrite ^/read\.php/([0-9]+)\.htm$ http://$host/post/$1/ permanent;
      rewrite ^/post/([0-9]+)\.htm$ http://$host/post/$1/ permanent;
      rewrite ^/post/([0-9]+)\_([0-9]+)\.htm$ http://$host/post/$1/$2/ permanent;
      rewrite ^/post/([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/post/$1/$2/$3/ permanent;
      rewrite ^/index\_([0-9]+)\_([0-9]+)\.htm$ http://$host/page/$1/$2/ permanent;
      rewrite ^/star\_([0-9]+)\_([0-9]+)\.htm$ http://$host/starred/$1/$2/ permanent;
      rewrite ^/category\_([0-9]+)\.htm$ http://$host/category/$1/ permanent;
      rewrite ^/category\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/category/$1/$2/$3/ permanent;
      rewrite ^/archive\_([0-9]+)\_([0-9]+)\.htm$ http://$host/archiver/$1/$2/ permanent;
      rewrite ^/archive\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/archiver/$1/$2/$3/$4/ permanent;
      rewrite ^/showday\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/date/$1/$2/$3/ permanent;
      rewrite ^/showday\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/date/$1/$2/$3/$4/$5/ permanent;

      #Filename alias
      rewrite ^/([a-zA-Z0-9_-]+)/?([0-9]+)?/?([0-9]+)?/?$ /read.php?blogalias=$1&page=$2&part=$3 last;
   }
8月22

点击在新窗口中浏览此图片
点击在新窗口中浏览此图片
康盛创想域名过户腾讯


    8月22日下午消息,域名注册信息显示,康盛创想所属comsenz.com、discuz.net等域名,已经全部过户腾讯。这也腾讯收购康盛创想传闻出现以来,首次出现确凿的证据。涉事双方均未对此明确表态。

  一直处于未证实状态的腾讯收购康盛创想一事,终于可以揭开面纱。

  最新的域名注册信息显示,康盛创想所属的comsenz.com以及discuz.net等域名,已经全部过户到腾讯北京分公司之下。例如,注册公司地址就更改为腾讯北京分公司的所在地址:海淀区,海淀大街,银科大厦16层。

  今年5月底中国互联网站长年会之前,即有消息透露康盛创想已被腾讯收购。据称,这一收购通过现金加股权的方式完成,交易价格约在1000万美元甚至更高的区间。然而,康盛创想和腾讯方面一直就此事双双予以否认。

  腾讯在互联网业内有过多次投资,按惯例一般都要求被投资公司完全保密。

  至截稿时,康盛创想CEO戴志康的电话一直未有人接听,而康盛创想副总裁李明顺也未对此予以正面回应。同样,腾讯公司也未进行公开表态。

  康盛创想的竞争对手之一杭州德天信息科技有限公司(即PHPWind),2008年底已被阿里巴巴收购。PHPWind和康盛创想的Discuz!同为草根站长用于建站的通用工具软件。

  有数据显示截至2010年6月,中国境内注册的网站总数达278.7万,其中多数是中小网站。其庞大的数量造就其成为中国网络的中坚力量。作为互联网业务推广的重要渠道,中小网站越发成为是互联网大佬争夺的对象。
1月27

在FreeBSD上安装Discuz!7.2,安装程序检测安装环境的时候提示:
xml_parser_create() 不支持 该函数需要 PHP 支持 XML。请联系空间商,确定开启了此项功能。

php有3个XML解析器:
1:基于Expat C库的事件驱动型解析器
2:基于DOM的解析器
3:适用于解析解单XML文件的解析器:Simple XML

xml_parser_create()函数就属于第一种:基于事件驱动的
以下是参考连接:
说明:
http://www.w3school.com.cn/php/php_xml_parser_expat.asp
安装配置:
http://cn.php.net/manual/en/xml.setup.php

解决方法:
重新安装FreeBSD里的php扩展(php-extension)。
安装完后,保证/usr/local/lib/php/20060613目录下有:
xml.so          xmlreader.so    xmlrpc.so       xmlwriter.so
四个扩展文件即可。

1月22
新安装的Discuz,登陆进入后台后,有个安全提示:
您开启了 运行 SQL 语句 功能。建议您只有在十分必要的时候才开启此它。请修改 config.inc.php 关闭此功能

ssh登陆到系统上,进入discuz程序所在的目录,编辑config.inc.php文件,找到:

$admincp['runquery'] = 1; // 是否允许后台运行 SQL 语句 1=是 0=否

修改为:

$admincp['runquery'] = 0; // 是否允许后台运行 SQL 语句 1=是 0=否


为了论坛安全,还是把discuz这个有用的功能给关闭了,需要的时候再登陆打开。

Tags: , ,
1月21

Discuz提示:mysql_connect() 不支持 请检查 mysql 模块是否正确加载
phpmyadmin提示:无法加载 mysql 扩展,请检查您的 PHP 配置。

在FreeBSD里安装Discuz!论坛程序,在安装过程中程序检测安装环境的时候,提示“mysql_connect() 不支持 请检查 mysql 模块是否正确加载”,同时发现另一个问题,phpmyadmin在访问的时候提示“无法加载 mysql 扩展,请检查您的 PHP 配置。”

网海茫茫,搜了好多文章,都是Windows下的解决方法。
没办法,自己想办法慢慢解决,以下是我的解决方法,以备不时之需:

产生原因:这两个问题都是因为php与mysql没有连接或者说是因为mysql扩展未被php所识别。
分析、解决过程:
1、先放了一个phpinfo.php文件在虚拟站点目录下面,检查php的环境,发现phpinfo未检测到mysql的信息,但mysql可以正常运行;
2、检查php-mysql,发现已经在安装php的时候已经安装过了,准备重启安装php-extensions,在执行编译过程中,发现有下列字样:
===> php5-extensions-1.3 depends on file: /usr/local/include/php/main/php.h - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/bz2.so - found

突想一想,这些so文件就是php里各种扩展,为什么会在/usr/local/lib/php/20060613目录里面呢?
马上进入/usr/local/lib/php/20060613目录,好家伙,php各种扩展文件(*.so)全都在这里,先全部cp到/usr/local/etc/php目录下,并手工在/usr/local/etc/php/extensions.ini文件里面添加相应的扩展,这里主要是mysql.so的扩展。

# vi /usr/local/etc/php/extensions.ini
手工添加extension=mysql.so到extensions.ini文件末尾,并在php.ini文件里找到“extension_dir = "./"”,将默认的“./”修改为php各种扩展的绝对路径,即:extension_dir = "/usr/local/etc/php/",保存退出php.ini文件。

重启FreeBSD系统,问题解决。

分页: 1/2 第一页 1 2 下页 最后页 [ 显示模式: 摘要 | 列表 ]