安装nginx:
安装php
在 nginx/html中放入php文件,执行成功即OK
如果没有pcre包,需要安装。在ubuntu下的安装命令为
sudo apt-get install libpcre3 libpcre3-dev
安装命令wget http://nginx.org/download/nginx-1.0.4.tar.gz tar -zxvf nginx-1.0.4.tar.gz cd nginx-1.0.4 ./configure --prefix=/home/wully/programs/nginx make & make install
安装php
如果没有libevent,需要安装。在ubuntu下的安装命令为
sudo apt-get install libevent-dev ./configure --prefix=/home/wully/programs/php --enable-fpm --with-mysql=/home/wully/programs/mysql cp ~/software/php-5.3.3/php.ini-production /home/wully/programs/php/
配置
启动cd /home/wully/programs/php/etc/ cp php-fpm.conf.default php-fpm.conf php-fpm.conf: listen = 127.0.0.1:9000
/home/wully/programs/php/sbin/php-fpm
检测一下ps -ef | grep php-fpm
nginx的配置
这里介绍通过端口模式的连接,当然还可以通过unix域进行连接。
cd /home/wully/programs/nginx/conf nginx.conf location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/wully/programs/nginx/html/$fastcgi_script_name; include fastcgi_params; }
在 nginx/html中放入php文件,执行成功即OK