升级安装 Nginx 1.3.0 和 为PHP 安装启用 APC 模块 

昨天,nginx 发布了其最新开发分支1.3.x 的第一个版本 - 1.3.0。果断升级,并且按照它之前的路线图显示,1.3.x 分支很有可能要增加对 SPDY 的支持。

下载源码包:
36 wget http://nginx.org/download/nginx-1.3.0.tar.gz

移除旧版本:
[root@PowerPC pub]# rm nginx*
rm: remove regular file `nginx-1.2.0.tar.gz'? y
rm: remove regular file `nginx-1.3.0.tar.gz'? n

解压,进入目录:
我的configure :
[root@PowerPC nginx-1.3.0]# ./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/run/nginx.pid \
> --lock-path=/var/lock/nginx.lock \
> --user=http \
> --group=web \
> --with-rtsig_module \
> --with-select_module \
> --with-poll_module \
> --with-file-aio \
> --with-http_image_filter_module \
> --with-http_flv_module \
> --with-http_mp4_module \
> --with-http_gzip_static_module \
> --without-http_ssi_module \
> --without-http_geo_module \
> --without-http_map_module \
> --without-http_rewrite_module \
> --without-http_proxy_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx/request \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --with-pcre

检查依赖,没有问题。之后系统给出编译概况,如下:

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/etc/sysconfig/nginx"
nginx configuration file: "/etc/sysconfig/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/tmp/nginx/request"


确认无误,make && make install.编译安装之。

之后,恢复配置文件即可.

nginx 升级完成。

接下来,考虑到我的PHP 5.4.0 一直都没有缓存模块,正好趁今天有时间一起搞定。

于是火速动手。

考虑到我以前一直用的eaccelerator,用的还蛮顺手的,故而还是用它。可是丫的已经很长时间没有更新了,SVN 的版本号永远的停留在了r427,最后更新2年前~

从SVN签出源码后,编译一下,居然报错。

奇怪,同样的版本,以前怎么没错?难道是不兼容PHP 5.4 + ?
果然,在它的sf.net 项目主页上,也看到了其他用户的反馈。
详见:http://sourceforge.net/projects/eaccelerator/reviews/

看来 eaccelerator 是指望不上了,好在还有 APC 和 Xcache 可选择。

最终还是选了APC (Alternative PHP Cache),毕竟是 PHP 团队自己在维护,信得过。

下载源码:
wget http://pecl.php.net/get/APC-3.1.10.tgz

解压,进入目录:
执行 phpize,生成 configure 等文件.

我的configure:
[root@PowerPC APC-3.1.10]# ./configure \
> --enable-apc \
> --enable-apc-memprotect \
> --with-php-config=/usr/local/bin/php-config

其实很简单,就是指明 php-config 的绝对路径即可。
之后,make 编译。

编译完成后,其实我要得apc.so 链接库文件已经生成了。
[root@PowerPC APC-3.1.10]# find . -name "*.so"
./.libs/apc.so
./modules/apc.so

直接可以把apc.so 复制到 php 的扩展文件夹下。
或者
通过 make install 安装至其目录。如下:
[root@PowerPC APC-3.1.10]# make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20100525/
Installing header files: /usr/local/php/include/php/

最后,编辑 php.ini 配置文件。
加入类似以下的APC 配置项:
extension=apc.so
apc.enabled=1
apc.shm_size=50M
apc.ttl=7200
apc.user_ttl=7200
apc.enable_cli=0

更多参数选项可以参考源码包下INSTALL 文件。

接下来,只需要重启PHP-FPM,就可以载入APC了。

启动所有服务后,查看PHPINFO:
http://cgi.xiazhengxin.name/phpinfo.php

一切OK。
[ ] ( 2478 次浏览 ) 永久链接 ( 3 / 2606 )

<< <上一页 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 下一页> >>