编译安装 Squid 3.1.1 通过 

这几天搞php搞得头昏,已经把遇到的问题提交到了 http://bugs.php.net/,等回答了

故决定先把php放一放。

于是便寻思着去为即将问世的web server 做一个缓存系统.

因为我的VPS流量是1TB,说大不大,说小也不小。所以搞个缓存机制也是可行的。

于是便瞄准了squid-cache 这个工具.

下载最新的3.1.1版本,解压,进入源码包

我的configure:

It was created by Squid Web Proxy configure 3.1.1, which was
generated by GNU Autoconf 2.62. Invocation command line was

$ ./configure --prefix=/usr/local/squid --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-icmp --enable-delay-pools --enable-esi --enable-icap-client --enable-ecap --enable-cachemgr-hostname=PowerPC --enable-arp-acl --enable-ssl --enable-cache-digests --enable-follow-x-forwarded-for --enable-stacktraces --with-default-user=cache

可能会要求安装iptables,不过那台linux系统里没有呢?

有个安装cppunit的警告,只要不需要 make check,该依赖不是必须的。

检查依赖通过,make && make install

安装成功.

完了之后,编辑/etc/sysconfig/squid.conf 文件.

因为我这个squid 只是用来做web 缓存的,所以只需要设置反向代理即可.
在配置文件顶上面加入下面几行:

http_port 80 accel defaultsite=184.82.15.110 vhost
#由于暂时没有域名指向,直接用ip
cache_peer 184.82.15.110 parent 81 0 no-query originserver name=myAcce
#我lighttpd 的端口是81
cache_peer_access myAccel allow all
#暂时没有接入规则

更多设置见:http://wiki.squid-cache.org/ConfigExamples/

保存退出后。
运行 squid -z 生成缓存数据 (确保squid uid 对目录有读写权限)
最后,运行 squid,启动缓存.

访问下 http://184.82.15.110,看看返回体。

HTTP/1.0 200 OK
Content-Type: text/html
Content-Length: 5794
Date: Mon, 19 Apr 2010 10:28:33 GMT
Server: lighttpd/1.4.26
X-Cache: MISS from PowerPC
X-Cache-Lookup: MISS from PowerPC:80
Via: 1.0 PowerPC (squid/3.1.1)
Connection: keep-alive

果然squid 开始工作了
___________________
访问 http://184.82.15.110:81/,返回体

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 5794
Date: Mon, 19 Apr 2010 10:53:29 GMT
Server: lighttpd/1.4.26

无缓存.
[ ] ( 1576 次浏览 ) 永久链接 ( 3 / 2251 )
编译安装 ProFTPD 1.3.3 通过 

想到为VPS安装一个ftp是必须的,于是便动手了.
因为proftpd没有用过,便想试试.
据说它提供像apache 那样的配置文件格式,很是友好

我的configure:
$ ./configure --prefix=/usr/local/proftpd --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-autoshadow --enable-nls --enable-openssl --enable-shadow --enable-buffer-size --enable-pool-size --enable-timeout-idle=180 --enable-transfer-buffer-size

检查依赖,缺openssl.故而 yum install openssl-devel

再次检查,通过

make && make install. 一切OK

然后复制源码包下的contrib下的几个几个第三方工具(如 ftpasswd) 到/usr/local/bin 下

再在 sample-configurations 下复制最适合自己的配置文件到 /etc/sysconfig 下,并改名为proftpd.config

因为我是私人的ftp,而且用的人很少,故选择 basic.conf.

接下来配置ftp虚拟用户,发现proftpd支持像vsftpd那样的通过mod_pam 连接mysql 验证用户.

不过,我比较喜欢通过本地文件存储用户信息.

编辑 proftpd.config 文件,加入

AuthUserFile /etc/proftpd.passwd
#定位用户信息存储文件路径
AuthOrder mod_auth_file.c mod_auth_unix.c
#指明验证方式.一定要有,不要像我一样,总是登不进去

use 和 group 可以自己指定.
我用的是系统自带的 ftp:ftp.
uid 14 ,giu 50

这个好了后,可以用第三方工具ftpasswd 添加虚拟用户.

ftpasswd -passwd --name=admin --uid=14 --gid=50 --home=/home --shell=/sbin/nologin --file=/etc/proftpd.passwd

输入两次密码即可,设置成功.

proftpd -t 测试一下配置文件
proftpd 启动ftp

ftp 127.0.0.1,输入用户名密码,登录成功
[ ] ( 2874 次浏览 ) 永久链接 ( 3 / 2408 )
源码安装 mysql 5.5.4-m3 

mysql刚刚发布了5.5 分支的第四个里程碑版本,于是下载安装.
前几天只有 x86_64 for linux 版本,今天已经放出了了i686版本.

我的configure:

It was created by MySQL Server configure.am 5.5.4-m3, which was
generated by GNU Autoconf 2.63. Invocation command line was

$ ./configure.am --prefix=/usr/local/mysql --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-profiling --with-charset=utf8 --with-extra-charsets=all --with-system-type=PowerOS --with-machine-type=PowerPC --with-mysqld-user=mysql --with-zlib-dir=bundled --with-low-memory --with-big-tables --with-ssl --with-embedded-server --with-embedded-privilege-control

检查依赖通过,但是在生成安装文件的时候,有了一行错误.
/bin/rm: cannot remove `libtoolT’: No such file or directory

查了一下,不影响安装.不过要再次生成conf 文件.

后来在源码包下INSTALL-SOURCE里面发现了源码编译前的准备步骤,可以避免这个错误.

2. Prepare the source tree for configuration:
shell> autoreconf --force --install
#发现autoconf 工具没装.
As an alternative to the preceding autoreconf command,
you can use BUILD/autorun.sh, which acts as a shortcut
for the following sequence of commands:
shell> aclocal; autoheader
shell> libtoolize --automake --force
#发现libtool 工具没装.
shell> automake --force --add-missing; autoconf
#发现automake 工具没装.

If you get some strange errors during this stage, verify
that you have the correct version of libtool installed.
删除源码文件夹,重新解压了下。
按照提示的步骤,走下去

检查依赖的时候,libtoolT 的错误的确没有了

不过,make 的时候居然报错了……囧rz

报zilb找不到,我日啊,我设置的zlib是mysql集成的,居然问我要zlib 库....

这个问题一时还找不到解决方案.

所幸libtoolT那个错误不影响安装使用,先忽略.以后再议.

接下来:
shell> groupadd mysql
shell> useradd -g mysql mysql
创建mysql 用户 组
shell> cp support-files/my-medium.cnf /etc/my.cnf
复制配置文件
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> mysql_install_db --user=mysql
安装初始数据.
shell> chown -R root .
shell> chown -R mysql var
shell> mysqld_safe --user=mysql &
成功启动mysql.
[ ] ( 1598 次浏览 ) 永久链接 ( 3.1 / 2183 )
编译安装 lighttpd 1.4.26 通过 

最近买的VPS刚到手,便忙活起来了

由于apache 2.3.5 alpha 与 php module 的不兼容,打算以Cherokee (上次试过,速度很快)作为web server.

于是乎,卸掉自带的apache 2.2,开始安装.

不过我这个人喜欢在一边看configure 参数,一边编译。由于VPS上没有预装ftp server.
所以便临时搭建了个服务器作为数据传输.

本想用nginx,想到从没试过lighttpd,就用它了.

下载源码,wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.26.tar.bz2

解压,进入目录

我的configure:

It was created by lighttpd configure 1.4.26, which was
generated by GNU Autoconf 2.65. Invocation command line was

$ ./configure --prefix=/usr/local/lighttpd --with-ldap --with-attr --with-openssl --with-zlib --with-bzip2 --with-fam --with-memcache

检查依赖,一秒钟报错.GCC no found……

新系统,真的很新

yum install gcc

再次检查依赖,pcre 没有,zlib没有,bzip没有,pkg-config没有

晕,依次安装.

最后检查,又报错~
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables FAM_CFLAGS
and FAM_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

fam 没有

yum install gamin
yum install fam-devel

这次OK了.

make && make install.安装成功

复制 源码包下doc下的lighttpd.conf到etc下.

稍加编辑后
/usr/local/lighttpd/sbin/lighttpd -t -f /etc/lighttpd.conf
测试一下
/usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd.conf
启动即可.
[ ] ( 1567 次浏览 ) 永久链接 ( 3 / 2209 )
分享之 Discuz! 的 RewriteRule for Cherokee 

把论坛架在Cherokee上,地址伪静态用的还是apache的,一点一个404……囧rz

现把我设好的重写规则,张贴如下(当然,你也可以自己到控制台设置,也不难)

适用于 一个documentRoot 为 /data/www/web/bbs 的discuz! 7.2 论坛:

vserver!30!document_root = /data/www/web/bbs
vserver!30!error_writer!filename = /usr/local/cherokee/var/log/cherokee.error
vserver!30!error_writer!type = file
vserver!30!keepalive = 1
vserver!30!logger = combined
vserver!30!logger!access!filename = /usr/local/cherokee/var/log/cherokee.access
vserver!30!logger!access!type = file
vserver!30!logger!x_real_ip_access_all = 0
vserver!30!logger!x_real_ip_enabled = 0
vserver!30!match = wildcard
vserver!30!match!domain!1 = bbs.xiazhengxin.*
vserver!30!nick = BBS
vserver!30!rule!1000!handler = redir
vserver!30!rule!1000!handler!rewrite!1!regex = ^/tag-(.+)\.html$
vserver!30!rule!1000!handler!rewrite!1!show = 0
vserver!30!rule!1000!handler!rewrite!1!substring = /tag.php?name=$1
vserver!30!rule!1000!match = request
vserver!30!rule!1000!match!request = ^/tag-(.+)\.html$
vserver!30!rule!1000!no_log = 0
vserver!30!rule!1000!only_secure = 0
vserver!30!rule!900!handler = redir
vserver!30!rule!900!handler!rewrite!1!regex = ^/space-(username|uid)-(.+)\.html$
vserver!30!rule!900!handler!rewrite!1!show = 0
vserver!30!rule!900!handler!rewrite!1!substring = /space.php?$1=$2
vserver!30!rule!900!match = request
vserver!30!rule!900!match!request = ^/space-(username|uid)-(.+)\.html$
vserver!30!rule!900!no_log = 0
vserver!30!rule!900!only_secure = 0
vserver!30!rule!800!handler = redir
vserver!30!rule!800!handler!rewrite!1!regex = ^/archiver/((fid|tid)-[\w\-]+\.html)$
vserver!30!rule!800!handler!rewrite!1!show = 0
vserver!30!rule!800!handler!rewrite!1!substring = /archiver/index.php?$1
vserver!30!rule!800!match = request
vserver!30!rule!800!match!request = ^/archiver/((fid|tid)-[\w\-]+\.html)$
vserver!30!rule!800!no_log = 0
vserver!30!rule!800!only_secure = 0
vserver!30!rule!700!handler = redir
vserver!30!rule!700!handler!rewrite!1!regex = ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
vserver!30!rule!700!handler!rewrite!1!show = 0
vserver!30!rule!700!handler!rewrite!1!substring = /viewthread.php?tid=$1&extra=page\=$3&page=$2
vserver!30!rule!700!match = request
vserver!30!rule!700!match!request = ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
vserver!30!rule!700!no_log = 0
vserver!30!rule!700!only_secure = 0
vserver!30!rule!600!handler = redir
vserver!30!rule!600!handler!rewrite!1!regex = ^/forum-([0-9]+)-([0-9]+)\.html$
vserver!30!rule!600!handler!rewrite!1!show = 0
vserver!30!rule!600!handler!rewrite!1!substring = /forumdisplay.php?fid=$1&page=$2
vserver!30!rule!600!match = request
vserver!30!rule!600!match!request = ^/forum-([0-9]+)-([0-9]+)\.html$
vserver!30!rule!600!no_log = 0
vserver!30!rule!600!only_secure = 0
vserver!30!rule!500!disabled = 0
vserver!30!rule!500!encoder!gzip = 1
vserver!30!rule!500!handler = fcgi
vserver!30!rule!500!handler!balancer = round_robin
vserver!30!rule!500!handler!balancer!source!1 = 1
vserver!30!rule!500!handler!error_handler = 1
vserver!30!rule!500!match = extensions
vserver!30!rule!500!match!extensions = php
vserver!30!rule!500!match!final = 1
vserver!30!rule!500!timeout = 30
vserver!30!rule!400!disabled = 0

_____________

把代码粘贴入cherokee.conf 相对位置即可.
[ ] ( 2034 次浏览 ) 永久链接 ( 3 / 2244 )

<< <上一页 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 下一页> >>