六,安装php加速器,xcache
1.编译安装xcache#cd /usr/src #tar xzvf xcache-2.0.0.tar.gz #cd xcache-2.0.0 #/usr/local/php/bin/phpize #./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config #make #make install
2.整合php跟xcache
#mkdir /etc/php.d #cp /usr/src/xcache-2.0.0/xcache.ini /etc/php.d/ #vim /etc/php.d/xcache.ini 将三行替换为以下行 zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so七,整合nginx跟php(FastCGI模式)
1. 编辑nginx主配置文件
access_log logs/bbs.log; } ##下面的是查看nginx状态的访问地址 配置下面的之后在地址栏输入 status.andy.com ##就可以看到并发连接数等等信息 server { listen 80; server_name status.andy.com; location / { stub_status on; access_log off; } } }
2.编辑/usr/local/nginx/conf/fastcgi.conf文件
#vim /usr/local/nginx/conf/fastcgi.conf fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200;3.建立网站目录及测试文件
#mkdir -pv /web/{www,bbs} #vim /web/www/index.php 内容如下 这个页面是测试php跟nginx <?php phpinfo(); ?> #vim /web/bbs/index.php 内容如下 这个页面是测试php跟MySQL <?php $link=mysql_connect('localhost','root',''); if ($link) echo ok; else echo no; mysql_close($link); ?>4.重启服务
#service nginx restart #service php-fpm restart #service mysqld restartok 到这里基本已经结束了。