分页: 2/25 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]
Mar 11
WordPress

location / {
  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;
  }
}

WordPress Mu

location /{
  server_name_in_redirect off;
  port_in_redirect off;

  rewrite ^.*/files/(.*) /wp-includes/ms-files.php?file=$1;
  rewrite ^/files/(.+) /wp-includes/ms-files.php?file=$1;

  if (!-e $request_filename) {
  rewrite ^.+?(/wp-.*) $1 last;
  rewrite ^.+?(/.*\.php)$ $1 last;
  rewrite ^ /index.php last;
  }
}

Drupal

location / {
  if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php?q=$1 last;
  }
}

Twip

location /{
  if (!-e $request_filename){
    rewrite ^/(.*)$ /index.php last;
  }
}

Typecho

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;
  }
}

Discuz

location / {
  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;
}

Discuz X

location / {
  rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  rewrite ^([^\.]*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
  if (!-e $request_filename) {
    return 404;
  }
}

Dabr

location / {
  if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php?q=$1 last;
  }
}

SaBlog

location / {
  rewrite “^/date/([0-9]{6})/?([0-9]+)?/?$” /index.php?action=article&setdate=$1&page=$2 last;
  rewrite ^/page/([0-9]+)?/?$ /index.php?action=article&page=$1 last;
  rewrite ^/category/([0-9]+)/?([0-9]+)?/?$ /index.php?action=article&cid=$1&page=$2 last;
  rewrite ^/category/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&curl=$1&page=$2 last;
  rewrite ^/(archives|search|article|links)/?$ /index.php?action=$1 last;
  rewrite ^/(comments|tagslist|trackbacks|article)/?([0-9]+)?/?$ /index.php?action=$1&page=$2 last;
  rewrite ^/tag/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&item=$1&page=$2 last;
  rewrite ^/archives/([0-9]+)/?([0-9]+)?/?$ /index.php?action=show&id=$1&page=$2 last;
  rewrite ^/rss/([^/]+)/?$ /rss.php?url=$1 last;
  rewrite ^/user/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&user=$1&page=$2 last;
  rewrite sitemap.xml sitemap.php last;
  rewrite ^(.*)/([0-9a-zA-Z\-\_]+)/?([0-9]+)?/?$ $1/index.php?action=show&alias=$2&page=$3 last;
        }

Xnote

location / {
  if (!-e $request_filename) {
    rewrite "^/([A-Za-z0-9\-]{4,20})$" /index.php?url=$1 last;
  }
}

Status.net

location / {
  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;
  }
}

PHP-Wind

location / {
rewrite ^thread-htm-tid-(\d+)-(.*).html  thread.php?fid=$1 last;
rewrite ^read-htm-tid-(\d+)-(.*).html  read.php?tid=$1 last;
rewrite ^commtopics-(.*)-(.*)  thread.php?fid=$1&page=$2 last;
rewrite ^commtopics-(.*)       thread.php?fid=$1&page=$2 last;
rewrite ^article-(.*)-(.*)-(.*).html  read.php?tid=$1&page=$2&fpage=$3 last;
rewrite ^article-(.*)-(.*).html       read.php?tid=$1&page=$2&fpage=$3 last;
rewrite ^article-(.*).html            read.php?tid=$1 last;
rewrite ^read-htm-tid-(\d+)-(.*).html  read.php\?tid=$1 last;
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
rewrite ^(.*)/u/([0-9]+)$ $1/u.php?uid=$2 last;
}

Bo-Blog

location / {
   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;
   }
}
Tags: ,
Mar 8
OWS是免费开源的运维管理平台,今天拿一台机器安装测试了下,功能上做的不错,只是还不够成熟。感兴趣的可以安装体验下,安装OWS的前提是你已经安装编译好了PHP+MYSQL环境。
一、下载源码文件

wget http://damo.openwebsa.org/down/ows_damo_v1.0.2_3.tar.gz
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c10.tar.gz#md5=30f822f19b02c3082cb1ba1d69be35dd
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2

二、编译安装

解压OWS文件并移到/usr/local/ows目录
# tar xvf ows_damo_v1.0.2_3.tar.gz
#mv ows /usr/local/ows
#chown -R nobody:nobody /usr/local/ows
#chmod 755 -R /usr/local/ows/unctrlsh/*

安装Python
#tar xvf Python-2.7.2.tgz
#cd Python-2.7.2
#./configure --prefix=/usr/local/ows/python
#make && make install
#/usr/local/ows/python/bin/python -V
Python 2.7.2

安装setuptools
#tar xzvf setuptools-0.6c10.tar.gz
#cd setuptools-0.6c10
#/usr/local/ows/python/bin/python setup.py build
#/usr/local/ows/python/bin/python setup.py install

安装MySQL-python
#which mysql_config
#tar xvf MySQL-python-1.2.3.tar.gz
#cd MySQL-python-1.2.3
#/usr/local/ows/python/bin/python setup.py build
#/usr/local/ows/python/bin/python setup.py install


三、创建数据库和导入数据库表

mysql>create database 数据库名 default charset utf8;
mysql>grant all privileges on 数据库名.* to 数据库用户名@127.0.0.1 identified by '数据库用户密码';
mysql>flush privileges;

数据库用户的权限可以只给:create,drop,delete,insert,update,select,lock tables。
然后导入数据库
#mysql -u数据库用户名 -p数据库用户密码 数据库名 < /usr/local/ows/openwebsa.sql
数据库导入之后需要修改ows数据库配置文件,一共需要修改两处
/usr/local/ows/ctrlphp/etc/ows_config.inc.php
/usr/local/ows/ctrlpy/etc/config.py

四、配置WEB页面
不管你用的是哪种支持PHP的WEB服务器软件,指定网站的目录为/usr/local/ows/ctrlphp就可以了,下面以APACHE别名的方式为例,打开apache的httpd.conf配置文件,添加如下内容:

Alias /ows /usr/local/ows/ctrlphp
<Directory "/usr/local/ows/ctrlphp">
    Options +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

保存之后,重新启动apache

五、启动相关服务
启动服务端
#cd /usr/local/ows/ctrlpy/
#chmod 755 ows_service.sh
#./ows_service.sh start
启动客户端
#cd /usr/local/ows/unctrlpy/
#chmod 755 ows_service.sh
#./ows_service.sh start
查看进程是否运行
# ps aux | grep py
查看监听端口
# netstat -tulnp | grep py
使用浏览器打开 http://ip/ows 登陆web管理平台
默认的账号:openwebsa  密码:openwebsa
进去之后别忘记修改密码,官方的演示地址是:http://damo.openwebsa.org 感兴趣的朋友可以进去看看,此管理平台目前来看还不是很完善,大家测出问题可以向官方反馈,以便程序尽快完善。
Tags: ,
Mar 5
一、下载需要的文件
wget http://labs.renren.com/apache-mirror//httpd/httpd-2.4.1.tar.gz
wget http://apache.etoak.com//apr/apr-1.4.6.tar.gz
wget http://apache.etoak.com//apr/apr-util-1.4.1.tar.gz


二、编译软件
tar xzvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
cd ..

tar xzvf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd ..

tar xzvf httpd-2.4.1.tar.gz
cd httpd-2.4.1/
./configure --prefix=/usr/local/webserver/apache --enable-so --enable-modules=all --enable-mods-shared=all --enable-vhost-alias --enable-deflate --enable-expires --enable-rewrite --enable-authn-dbm=shared --enable-ssl --with-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
make && make install

Apache HTTP Server项目团队称,这是最新的、也是最好的一个版本,添加了许多新的模块,扩展了现有的功能,增强了灵活性。众多的性能及功能改进,使得该版本更适合日益流行的云环境。

该版本的主要改进包括:

改善了服务器性能(减少了资源利用,增强了并发能力)
支持异步I/O
动态反向代理配置
比纯事件驱动的Web服务器的性能更好
更精准的超时和资源利用限制能力
增强了微调缓存支持,专为高流量服务器和代理服务器打造
Mar 2
下载msmtp软件,当前最新版1.4.27
http://downloads.sourceforge.net/project/msmtp/msmtp/1.4.27/msmtp-1.4.27.tar.bz2
1、编译软件
tar jxvf msmtp-1.4.27.tar.bz2
cd  msmtp-1.4.27
./configure --prefix=/usr/local/msmtp
make
make install
 
2、看一下配置文件在哪里
# /usr/local/msmtp/bin/msmtp --version
msmtp version 1.4.27
Platform: x86_64-unknown-linux-gnu
TLS/SSL library: OpenSSL
Authentication library: built-in
Supported authentication methods:
plain cram-md5 external login
IDN support: enabled
NLS: enabled, LOCALEDIR is /usr/local/msmtp/share/locale
Keyring support: none
System configuration file name: /usr/local/msmtp/etc/msmtprc#默认配置文件的路径
User configuration file name: /root/.msmtprc

Copyright (C) 2012 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License .
There is NO WARRANTY, to the extent permitted by law.
 
3、msmtp的配置文件
mkdir -p  /usr/local/msmtp/etc
touch /usr/local/msmtp/msmtp.log

vi /usr/local/msmtp/etc/msmtprc
输入以下内容
defaults
logfile /usr/local/msmtp/msmtp.log
account gmail
tls on
host smtp.gmail.com
port 587
from username@gmail.com
tls_certcheck off
auth login
user username@gmail.com
password password
account default : gmail

4、配置mutt
一般系统已经安装了,如果没有安装的话请使用 yum install mutt 安装
# tail -5 /etc/Muttrc
#vi /etc/Muttrc.local

set sendmail="/usr/local/msmtp/bin/msmtp"
set realname="测试服务器"
set use_from="yes"
set charset="UTF-8"
set editor="vi"

5、测试一下发送邮件
#echo "测试邮件内容" | mutt -s "测试邮件主题" username@domain.com
tail -f /usr/local/msmtp/msmtp.log 看看有没有成功,或者进入上面的邮箱看看是否收到邮件。
Tags: , ,
Feb 21
pathping 命令是一个路由跟踪工具,它将 ping 和 tracert 命令的功能和这两个工具所不提供的其他信息结合起来。pathping 命令在一段时间内将数据包发送到到达最终目标的路径上的每个路由器,然后基于数据包的计算机结果从每个跃点返回。由于命令显示数据包在任何给定路由器或链接上丢失的程度,因此可以很容易地确定可能导致网络问题的路由器或链接。

参数介绍

选项 名称 功能
-n Hostnames 不将地址解析成主机名。
-h Maximum hops 搜索目标的最大跃点数。
-g Host-list 沿着路由列表释放源路由。
-p Period 在 ping 之间等待的毫秒数。
-q Num_queries 每个跃点的查询数。
-w Time-out 为每次回复所等待的毫秒数。
-T Layer 2 tag 将第 2 层优先级标记(例如,对于 IEEE 802.1p)连接到数据包并将它发送到路径中的每个网络设备。这有助于标识没有正确配置第 2 层优先级的网络设备。-T 开关用于测试服务质量 (QoS) 连通性。
-R RSVP isbase Che检查以确定路径中的每个路由器是否支持“资源保留协议 (RSVP)”,此协议允许主机为数据流保留一定量的带宽。 -R 开关用于测试服务质量 (QoS) 连通性。

默认的跃点数是 30,并且超时前的默认等待时间是 3 秒。默认时间是 250 毫秒,并且沿着路径对每个路由器进行查询的次数是 100。

以下是典型的 pathping 报告。跃点列表后所编辑的统计信息表明在每个独立路由器上数据包丢失的情况。
C:\Documents and Settings\Administrator>pathping www.163.com

Tracing route to 163.xdwscache.glb0.lxdns.com [60.173.8.216]
over a maximum of 30 hops:
  0  ZHJ-WORK [192.168.1.166]
  1  60.168.112.1
  2  60.168.112.1
  3  61.190.245.45
  4  118.84.1.9
  5  118.84.2.6
  6  61.191.10.102
  7  60.173.8.22
  8  60.173.8.216

Computing statistics for 200 seconds...
            Source to Here   This Node/Link
Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
  0                                           ZHJ-WORK [192.168.1.166]
                                0/ 100 =  0%   |
  1    3ms     0/ 100 =  0%     0/ 100 =  0%  60.168.112.1
                                0/ 100 =  0%   |
  2    2ms     0/ 100 =  0%     0/ 100 =  0%  60.168.112.1
                                0/ 100 =  0%   |
  3    3ms     0/ 100 =  0%     0/ 100 =  0%  61.190.245.45
                                0/ 100 =  0%   |
  4    5ms     0/ 100 =  0%     0/ 100 =  0%  118.84.1.9
                                0/ 100 =  0%   |
  5    8ms     0/ 100 =  0%     0/ 100 =  0%  118.84.2.6
                                0/ 100 =  0%   |
  6    6ms     0/ 100 =  0%     0/ 100 =  0%  61.191.10.102
                                0/ 100 =  0%   |
  7    8ms     0/ 100 =  0%     0/ 100 =  0%  60.173.8.22
                                0/ 100 =  0%   |
  8    8ms     0/ 100 =  0%     0/ 100 =  0%  60.173.8.216

Trace complete.
当运行 pathping 时,在测试问题时首先查看路由的结果。此路径与 tracert 命令所显示的路径相同。然后 pathping 命令对下一个 125 毫秒显示忙消息(此时间根据跃点计数变化)。在此期间,pathping 从以前列出的所有路由器和它们之间的链接之间收集信息。在此期间结束时,它显示测试结果。
Tags:
分页: 2/25 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]