编译安装 nginx/0.8.50 与 lighttpd/1.4.28 通过 

做好了varnish cache 缓存服务器,现在搞定几个后置服务器.
cherokee 还是我的主服务器,跑 php-cgi 程序,我打算用nginx 作为静态资源服务器,而lighttpd 则分流一部分的php-cgi程序.至于tomcat 则是跑 java 程序。

这样一来就很清楚了,于是今天便动手编译nginx 和 lighttpd.

下载各自的最新版本,解压,进入目录

先是nginx,最新的开发版 0.8.50

我的configure:
[root@PowerPC nginx-0.8.50]# ./configure \
> --prefix=/usr/local/nginx \
> --sbin-path=/usr/local/sbin/nginx \
> --conf-path=/etc/sysconfig/nginx/nginx.conf \
> --error-log-path=/var/log/nginx/error.log \
> --pid-path=/var/nginx.pid \
> --lock-path=/var/nginx.lock \
> --user=http \
> --group=web \
> --with-select_module \
> --with-poll_module \
> --with-file-aio \
> --with-http_flv_module \
> --with-http_gzip_static_module \
> --without-http_ssi_module \
> --without-http_auth_basic_module \
> --without-http_geo_module \
> --without-http_map_module \
> --without-http_referer_module \
> --without-http_rewrite_module \
> --without-http_proxy_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --without-http_upstream_ip_hash_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx/request.tmp \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --without-pcre

检查依赖,一切顺利.接下来make && make install.速度也很快。

很快安装好了.

编辑生成的 nginx.conf (位于/etc/sysconfig/nginx 下),因为我是用来做纯静态资源服务器的,所以删除了一切关于cgi/scgi/fcgi 之类的配置,只是做了几个virtualhost 而已.

server {
listen 83;
server_name xiazhengxin.tk;
charset utf-8;
root /home/http/xiazhengxin_tk/;
index index.html index.htm;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 83;
server_name xiazhengxin.net.cn;
charset utf-8;
root /home/http/xiazhengxin_net_cn/;
index index.html index.htm;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}


配置完成后,nginx -t 测试一下,ok.

运行nginx 启动服务器.

试图从浏览器访问,失败.

查看日志文件(/var/log/nginx/error.log),发现里面出现了

2010/09/12 13:09:09 [emerg] 28358#0: eventfd() failed (38: Function not implemented)
2010/09/12 13:09:09 [alert] 28357#0: worker process 28358 exited with fatal code 2 and can not be respawn


这样的字样,搜索了一下 eventfd() 函数,发现是File AIO在作怪.

而aio 只在高版本的linux kernel 上才支持.
Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only

而我的centos 内核是:
Linux PowerPC 2.6.18-128.2.1.el5.028stab064.4 #1 SMP Mon Jul 27 12:45:01 MSD 2009 i686 i686 i386 GNU/Linux

好吧,我情绪稳定.

去掉 --with-file-aio 参数.重新编译安装nginx.
这次没问题了(同样的配置下).

接下是lighttpd,我的cofnigure:
[root@PowerPC lighttpd-1.4.28]# ./configure \
> --prefix=/usr/local/lighttpd \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/lighttpd \
> --localstatedir=/var \
> --enable-lfs=no \
> --disable-ipv6 \
> --without-mysql \
> --without-ldap \
> --with-attr \
> --without-openssl \
> --without-kerberos5 \
> --with-zlib \
> --with-bzip2 \
> --without-fam \
> --without-webdav-props \
> --without-webdav-locks \
> --without-gdbm \
> --with-memcache \
> --without-lua

依赖没有问题,然后 make && make install. 编译 安装至指定目录.
接下来复制源码包中doc文件夹下的config 里面的所有配置文件到/etc/sysconfig/lighttpd下.

稍加编辑即可.我主要是启用了mod_simple_vhost、mod_fastcgi、mod_compress 几个模块.
接着编辑conf.d目录下的对应文件即可.

配置完成后,测试一下
lighttpd -f lighttpd.conf -t 测试通过.
即可启动服务器.
lighttpd -f lighttpd.conf 启动.
[ ] ( 2246 次浏览 ) 永久链接 ( 3.1 / 2475 )
编译安装 Varnish Cache 2.1.3 通过 

前端时间,squid 爆了漏洞,心里感觉还是不能情绪稳定.最近又看到了varnish 这款http 缓存服务器的崛起,觉得很是棒.

再者说,squid 本不是专业反向代理服务器(服务端缓存),而是正向代理服务器(客户端缓存).而varnish cache 则是专业做反向代理的。这是其一.

再者,squid 的体积越来越大,这是我不敢想的。源码压缩包 3M多,解压后竟达10多M...

再看varnish 则小巧了许多.不要1M.解压后才3M多.而且在内存占用方面,varnish 更是让我这台512M 的vps 轻松的多。

最后一点,varnish 的效率据说高于squid.有这么多的理由,我便干掉了squid,投奔varnish了.

下载最新版本 2.1.3 的源码包,解压,进入目录
我的configure:
[root@PowerPC varnish-2.1.3]# ./configure \
> --prefix=/usr/local/varnish \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/varnish \
> --localstatedir=/var \
> --enable-shared=yes \
> --enable-static=no \
> --disable-largefile

检查依赖,一切OK.接下来 make && make install.
编译时间很快,比起squid 真是快了几倍。呵呵

编辑自动生成的default.vcl 配置文件,这里要说一下,不同于一下配置文件的格式,varnish 使用的是一个叫VCL (Varnish Confingure Language)的语言作为配置文件。囧rz 其实就是一些很简单的条件判断语句什么 if else 之类的.
更不会有switch 之类的,只要你写过一点程序,这些都不是难题.

为了让用户更好的编辑VCL文件,varnish 还提供了用于VIM 的语法高亮文件.
地址:http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/~checkout~/packages/vim-syntax-vcl/vcl.vim

下载放到指定目录即可.

接下开始编辑配置文件,按照官方的wiki提示,
新建几台后置服务器,分别运行于不同端口.

比如我的vps 有cherokee、nginx、lighttpd、tomcat 等.

backend to_cherokee {
.host = "127.0.0.1";
.port = "81";
}

backend to_lighttpd {
.host = "127.0.0.1";
.port = "82";
}

backend to_nginx {
.host = "127.0.0.1";
.port = "83";
}

backend to_tomcat {
.host = "127.0.0.1";
.port = "84";
}


再根据不同的域名转发到对应的后置服务器,

if (req.http.host ~ "^(\w*.)?xiazhengxin.cn$") {
set req.backend = to_cherokee;
}

if (req.http.host ~ "^(\w*.)?xiazhengxin.tk$") {
set req.backend = to_nginx;
}

if (req.http.host ~ "^(\w*.)?xiazhengxin.org.cn$") {
set req.backend = to_lighttpd;
}

if (req.http.host ~ "^(\w*.)?xxx.xxx$") {
set req.backend = to_tomcat;
}


上段代码须放入sub vcl_recv {} 块中.

当然还可以自定义错误.编辑 sub vcl_error {} 块即可.

更多配置详见:http://www.varnish-cache.org/trac/wiki/VCL

这里还有一些例子可供参考:
http://www.varnish-cache.org/trac/wiki/VCLExamples

一切配置完成后,运行 varnishd 启动服务器.
报错:
varnishstat: error while loading shared libraries: libvarnish.so.1: cannot open shared object file: No such file or directory


运行ldconfig 即可.

再次运行
[root@PowerPC varnish]# varnishd -a :80 -f default.vcl -u http
启动成功.
[ ] ( 2679 次浏览 ) 永久链接 ( 3 / 2574 )
编译安装 eAccelerator revision 427 for php 通过 

想到自己自从编译安装了php 5.3.3 以来还没有为它安装个缓存器,于是今天便动手了.

先从svn 里面签出最新版本 svn --username anonymous --password anonymous co http://dev.eaccelerator.net/eaccelerator/trunk eaccelerator

svn: Repository moved temporarily to 'https://svn.eaccelerator.neteaccelerator/trunk'; please relocate

提示地址更换,囧rz 怎么官网地址没更新呢

更换地址再次签出,svn --username anonymous --password anonymous co https://svn.eaccelerator.net/eaccelerator/trunk eaccelerator
成功.

进入目录,phpize 生成 configure 文件.
我的configure:
[root@PowerPC eaccelerator]# ./configure \
> --prefix=/usr/local/php/eaccelerator \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig \
> --localstatedir=/var \
> --enable-eaccelerator \
> --enable-static=no

检查依赖,没有问题.make && make install 编译安装.

接下来让php 载入 eaccelerator.so 模块.
编辑/etc/php.ini

插入一下内容:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

注:更多设置,参见 http://www.eaccelerator.net/wiki/Settings

保存,killall php-fpm 杀掉所有php-fpm 进程.
再次启动php-fpm 即可.
注:/tmp/eaccelerator 目录我已经有了。且确保可写入.

查看版本信息:
[root@PowerPC ~]# php-fpm -v
PHP 5.3.3 (fpm-fcgi) (built: Jul 31 2010 11:36:42)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with eAccelerator v1.0-dev, Copyright (c) 2004-2010 eAccelerator, by eAccelerator

一切正常,安装完成.
[ ] ( 4294 次浏览 ) 永久链接 ( 3 / 2618 )
编译安装 Wine 1.3.1 通过 

昨天吧,wine 开发组发布了 wine 1.3.x 的开发版.而我还在使用之前编译的1.1.44.
而官方源里面也早已是稳定版 1.2 了.

所以我便打算,升级一下我的wine.

下载源码包,解压,进入目录

我的configure:
sharl@sharl-laptop:~/下载/wine-1.3.1$ ./configure \
> --prefix=/usr/local/wine \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig \
> --localstatedir=/var \
> --disable-win16 \
> --disable-tests \
> --disable-largefile \
> --with-x

检查依赖,wine 基本没有什么必须的外部依赖.它所需的大部分依赖也全都自带了.这也是为什么wine 的源码包体积如此之大的原因.

检查完依赖后,运行 make 进行编译。这个时间会非常的长.我机器3G内存也用了大概十几分钟.好在我已经习惯了.

编译完成后,make install 安装至指定目录.

最后运行 winecfg 设置一下(比如安装Gecko、生成driver_c 路径等)即可.
[ ] ( 2566 次浏览 ) 永久链接 ( 3 / 2497 )
编译安装 Audacious 2.4 rc2 通过 

最近看到audacious 官方放出了2.4 分支的第二个候选版本,将是2.x 的第一个稳定分支,而且从2.4 开始默认使用 GTKUI 作为默认界面.这个我很是喜欢.应为很像windows 下的foobar2k,那样的清爽的界面很棒,于是迫不及待的升级。

apt-get purge audacious .卸载掉了我之前安装源里面的2.3 版本.下载源码开始自己编译安装.

下载首页提供的地址,下载 audacious-x.xx.tgz、audacious-plugins-x.xx.tgz 主程序和插件包.解压,进入目录

先编译主程序

我的configure:
sharl@sharl-laptop:~/下载/audacious-2.4-rc2$ ./configure \
> --prefix=/usr/local/audacious \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig \
> --localstatedir=/var \
> --disable-altivec \
> --disable-user-plugin-dir \
> --with-buildstamp=Sharl_MUSIC \
> --with-included-gettext \
> --with-regexlib=gnu

检查依赖,报错,缺少 libmowgli、libmcs 两个库.

执行
sudo apt-get install libmowgli-dev
sudo apt-get install libmcs-dev

问题依旧.libmowgli 还是不满足.要求版本高于 0.7.0. 可是ubuntu源里只有0.6.x.

下载源码自己编译安装,libmowgli项目是audacious 在维护的,主页 http://www.atheme.org/project/mowgli

下载源码包:http://mirror.billymays.us/libmowgli/libmowgli-0.7.1.tgz

解压进入目录:
直接 ./configure && make && make install 即可.

完了后,回到audacious 主程序目录,再次检查依赖,通过.

开始编译.如果 make 出错,错误信息如下的话

gcc: /intl/libintl.a: 没有那个文件或目录
Failed to link audacious2!
make[5]: *** [audacious2] 错误 1
make[4]: *** [all] 错误 1
make[3]: *** [subdirs] 错误 1
make[2]: *** [all] 错误 1
make[1]: *** [subdirs] 错误 1
make: *** [all] 错误 1


看看configure 参数里面是不是有 "--with-included-gettext",删掉即可.audacious 只带了libintl.a.

注:configure string 中最好加上 “--enable-chardet” 以启用字符编码自动识别.不然会乱码.

make 完成后。make install 安装到指定目录.主程序安装成功.

接下来编译插件.进入插件目录

我的configure:
sharl@sharl-laptop:~/下载/audacious-plugins-2.4-rc2$ ./configure \
> --prefix=/usr/local/audacious/plugins \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig \
> --localstatedir=/var \
> --enable-chardet \
> --disable-altivec \
> --disable-mms \
> --disable-bluetooth

检查依赖,报错:
configure: WARNING: *** Cannot find libFLAC, FLACng will not be built ***
configure: WARNING: *** Cannot find WavPack 4.31+, WavPack support will not be built ***
configure: WARNING: Could not find libsamplerate, necessary for jack output plugin.

运行
sudo apt-get install libflac++-dev
sudo apt-get install libsamplerate-dev
sudo apt-get install libwavpack-dev

再次检查,通过.

然后 make && make install. 时间可能会比较长.一切完成后.
audacious 安装成功了.

运行 audcious,出现了主界面,果然,GTKUI 成为了默认界面.
附图一张:

[ ] ( 2228 次浏览 ) 永久链接 ( 3 / 2430 )

<< <上一页 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 下一页> >>