线上环境,centos6.3的系统。php
1.安装nginxhtml
wget http://www.nginx.com.cn/download/nginx-1.3.9.tar.gzmysql
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gzxcachenginx
wget http://zlib.net/zlib-1.2.8.tar.gzsql
wget http://www.openssl.org/source/openssl-1.0.0j.tar.gzcentos
wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz 图片缓存模块api
./configure --user=www --group=www --prefix=/usr/local/nginx --with-openssl=../openssl-1.0.0j --with-zlib=../zlib-1.2.8 --with-pcre=../pcre-8.30 --with-http_ssl_module --add-module=../ngx_cache_purge-2.1 --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module缓存
make && make installcurl
2.安装完成以后,就能够启动nginx了。socket
/usr/local/nginx/sbin/nginx
3.查看nginx有没有启动
netstat -napt | grep nginx
4.而后经过ip访问
5.因为本机上已经有mysql了,这里就忽略掉
6.咱们直接安装php了
安装php以前,咱们得先安装库文件.这里就用yum安装吧
yum -y install libmcrypt* mhash* libxml2* libpng* freetype* libjpeg* bzip* libcurl*
13.编辑/usr/local/nginx/conf/nginx.conf,整合nginx和php,并启用以下选项:
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
root html;
index index.html index.htm index.php;
}
14.改完这几处地方就差很少了,重启下nginx
15.测试下php是否是能正常显示了
16.接下来开始编译xcache
wget http://xcache.lighttpd.net/pub/Releases/3.0.3/xcache-3.0.3.tar.gz
./configure --enable-xcache --enable-xcache-coverager --with-php-config=/usr/local/php/bin/php-config
make && make install
17.编辑php.ini,整合php和xcache
mkdir /etc/php.d
cp xcache.ini /etc/php.d
18.编辑/etc/php.d/xcache.ini,找到extension开头的行,修改成以下行:
extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so
19.从新启动php-fpm进程
service php-fpm restart
chkconfig php-fpm on
20.从新打开测试页面,就能够看到了