编译安装 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 / 2474 )

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