12月14
官网: http://openresty.org/
虽然是中国人做的,但没几个汉字……

我用Nginx,是这样一个过程:
1、系统rpm中的nginx,能让其跑起来
2、玩配置文件
3、玩编译选项
4、写插件,集成第三方插件

OpenResty,是淘宝一位大牛(agentzh)集成的包含N多好插件的Nginx捆绑源码包,这位仁兄自称Nginx最活跃的第三方模块开发人员哦!

下面,当然要列一下到底集成了什么模块(已经根据agentzh的微博提醒进行修正):

LuaJIT - 极速版Lua实现
ArrayVarNginxModule - 数组类型的Nginx变量
AuthRequestNginxModule - 鉴权,想象一下以C代码的速度判断一个请求是否合法,是不是很有快感呢?!
DrizzleNginxModule - Nginx-MySQL桥,非阻塞的哦,我又爱又恨的一个模块,值得注意的是,其响应是RDS流
EchoNginxModule - 以非常直观的方式在Nginx配置文件中编写简单的处理逻辑,源码包含大量注释,绝对是入门好例子!!??
EncryptedSessionNginxModule - 加密会话
FormInputNginxModule - 解析post请求中的参数,这下子,简单请求根本不需要PHP/Java来处理啦
HeadersMoreNginxModule - Nginx默认的header模块只能添加或忽略,这个给你CRUD全套的!!
IconvNginxModule - 编码转换,不多说,也不懂
StandardLuaInterpreter - 与Lua官方实现所匹配,一般用不上,因为我们用LuaJIT!!
MemcNginxModule - 与Memcached的绝配,谁用谁知道!!与upstram_keepalive一起用,你能更High!!

Nginx
NginxDevelKit - N多第三方插件都依赖的东西,不知道为啥 提供一些方便使用的基础API封装
LuaCjsonLibrary - Lua版的Json处理库实在太慢,这个才叫速度!!
LuaNginxModule - 我的最爱,一般逻辑,完全没必要用Java/PHP啦
LuaRdsParserLibrary - 在Lua中直接处理RDS流,速度杠杠的!
LuaRedisParserLibrary - 在Lua中处理Redia模块的响应,暂时我还没用上
PostgresNginxModule - Nginx-Postgres桥,输出的也是RDS流
RdsCsvNginxModule - RDS流转CVS格式,不知道能干啥,报表?
RdsJsonNginxModule - RDS流转JSON字符串,之前经常用这个
Redis2NginxModule - Nginx-Redis2桥
SetMiscNginxModule - 提供很多很实用的方法,例如base64编解码,URL编解码,SQL防注入等等
SrcacheNginxModule - 缓存模块,据说跟Memc模块一起用比较爽
UpstreamKeepaliveNginxModule - 与Memc模块的标配,号称性能提升几倍呢
XssNginxModule - 防跨站攻击的 通过Jsonp进行跨站ajax编程

OpenResty的最大的好处是帮你弄清楚各个模块的编译顺序,别小看,学问大大的呢!

当初没有这东西,单单弄清楚模块间的编译顺序就耗费不少时间。

来吧,试试这个国产的精品!!!
11月29
为有效管理squid代理服务器,为客户端添加了用户认证功能,此功能需要借助httpd的htpasswd功能。
1、编辑squid.conf,添加以下内容:
auth_param basic program /usr/local/squid/lilbexec/ncsa_auth /etc/squid.pass
acl auth_user proxy_auth REQUIRED
http_access allow auth_user

2、利用htpasswd生成用户名和密码:
# htpasswd -c /etc/squid.pass username
输入两次该用户的密码即可,下次再添加其他用户的时候,无需再带-c参数。

3、重启squid服务
# service squid restart


客户端再通过squid代理上网的话,就需要进行帐号及密码的认证了。
Tags: , ,
11月24
1、问题:
# /usr/local/squid/sbin/squid -k /etc/squid.conf
squid: ERROR: No running copy

2、解决:
查看squid主进程的pid值:
# ps aux | grep squid
nobody      2376  0.0  0.0   4168   572 ?        Ss   00:56   0:00 /usr/local/squid/sbin/squid -D -s -f /etc/squid.conf
nobody    2378  0.0  0.4   6296  4232 ?        S    00:56   0:00 (squid) -D -s -f /etc/squid.conf
nobody      2496  0.0  0.0   4016   692 pts/0    R+   00:59   0:00 grep squid
# echo "2378" > /usr/local/squid/var/logs/squid.pid

搞定。
Tags: , , , ,
11月24
#!/bin/bash

# squid         This shell script takes care of starting and stopping
#               Squid Internet Object Cache
#
# chkconfig: - 90 25
# description: Squid - Internet Object Cache. Internet object caching is \
#       a way to store requested Internet objects (i.e., data available \
#       via the HTTP, FTP, and gopher protocols) on a system closer to the \
#       requesting site than to the source. Web browsers can then use the \
#       local Squid cache as a proxy HTTP server, reducing access time as \
#       well as bandwidth consumption.
#
#pidfile=/usr/local/squid/var/logs/squid.pid
#config=/etc/squid.conf
  
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
  
# Source function library.
. /etc/rc.d/init.d/functions
  
# Source networking configuration.
. /etc/sysconfig/network
  
# don't raise an error if the config file is incomplete
# set defaults instead:
SQUID_OPTS=${SQUID_OPTS:-"-D"}
SQUID_PIDFILE_TIMEOUT=${SQUID_PIDFILE_TIMEOUT:-20}
SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100}
  
squid=/usr/local/squid/sbin/squid
squid_config=/etc/squid.conf
squid_pid=/usr/local/squid/var/logs/squid.pid
  
# determine the name of the squid binary
[ -f $squid ] && prog="squid"
  
# determine which one is the cache_swap directory
CACHE_SWAP=`sed -e 's/#.*//g' $squid_config | grep cache_dir |  awk '{ print $3 }'`
  
[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/cache
  
RETVAL=0
  
start() {
    if [ ! -f $squid_config ]; then
        echo "Configuration file $squid_config missing" 1>&2
            exit 6
        fi
    if [ -z "$squid" ]; then
                echo "Insufficient privilege" 1>&2
                exit 4
        fi
    for adir in $CACHE_SWAP; do
        if [ ! -d $adir/00 ]; then
             echo -n "init_cache_dir $adir... "
             $squid -z -f $squid_config >> /usr/local/squid/var/logs/cache.log
        fi
    done
    echo -n $"Starting $prog: "
    $squid $SQUID_OPTS -s -f $squid_config >> /usr/local/squid/var/logs/cache.log 2>&1
    RETVAL=$?
    if [ $RETVAL -eq 0 ]; then
           timeout=0;
           while : ; do
          [ ! -f $squid_pid ] || break
          if [ $timeout -ge $SQUID_PIDFILE_TIMEOUT ]; then
             RETVAL=1
             break
          fi
          sleep 1  
          timeout=$((timeout+1))
           done
    fi
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    [ $RETVAL -eq 0 ] && echo_success
    [ $RETVAL -ne 0 ] && echo_failure
    echo
    return $RETVAL
}
  
stop() {
    echo -n  $"Stopping $prog: "
    $squid -k check -f $squid_config >> /usr/local/squid/var/logs/cache.log 2>&1
    RETVAL=$?
    if [ $RETVAL -eq 0 ] ; then
        $squid -k shutdown -f $squid_config &
        rm -f /var/lock/subsys/$prog
        timeout=0
        while : ; do
            [ -f $squid_pid ] || break
            if [ $timeout -ge $SQUID_SHUTDOWN_TIMEOUT ]; then
                echo
                return 1
            fi
            sleep 2  
            timeout=$((timeout+2))
        done
        echo_success
        echo
    else
        echo_failure
        if [ ! -e /var/lock/subsys/$prog ]; then
            RETVAL=0
        fi
        echo
    fi
    return $RETVAL
}
  
reload() {
    $squid -k reconfigure -f $squid_config
    echo -n  $"reload_config $prog: "
    echo_success
    echo
}
  
restart() {
    stop
    sleep 5
    start
}
  
condrestart() {
    [ -e /var/lock/subsys/squid ] && restart || :
}
  
rhstatus() {
    status $squid && $squid -k check -f $squid_config
}
  
probe() {
    return 0
}
  
case "$1" in
start)
    start
    ;;
  
stop)
    stop
    ;;
  
reload)
    reload
    ;;
  
restart)
    restart
    ;;
  
condrestart)
    condrestart
    ;;
  
status)
    rhstatus
    ;;
  
probe)
    exit 0
    ;;
  
*)
    echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
    exit 2
esac
  
exit $?

注意squid相关文件的实际路径,不要原本照搬!
Tags: , ,
11月15
    Clonezilla 是一个很好的系统克隆工具,它可以说是吸取了 Norton Ghost 和 Partition Image 的优点。即不仅支持对整个系统进行克隆,而且也可以克隆单个的分区,这种灵活性可能更能适应备份者的需要。

点击在新窗口中浏览此图片



    有需求的朋友不妨关注下 Clonezilla 的功能:

    在 GNU/Linux 端所支持的文件系统包括:ext2、ext3、reiserfs、xfs、jfs;同时,Clonezilla 也支持 M$ Windows 上的 FAT、NTFS 文件系统。这意味着,你既可以使用 Clonezilla 克隆 GNU/Linux 系统,也能够对 M$ Windows 系统进行克隆。
    Clonezilla 支持使用 PXEBoot 来进行 Multicast 克隆。这对于需要克隆大量系统的用户极为有用。
    CloneZilla 包括一个 Live 版,让你无需对其安装即可克隆系统。
分页: 1/31 第一页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]