1、编译安装nginx
tar -zxvf nginx-1.0.9.tar.gz -C /usr/local/src
./configure --prefix=/usr/local/nginx109 --with-http_stub_status_module --with-http_ssl_module --user=nginx --group=nginx
make && make install
/usr/local/nginx/sbin/nginx start
netstat -anplt | grep :80
elinks 127.0.0.1
2、编译安装mysql
tar -xzvf mysql-mysql-5.1.34.tar.gz -C /usr/local/src
如果不存在mysql 用户,则建立之
./configure --prefix=/usr/local/mysql
make && make install
rm -rf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db
chown -R mysql: mysql /usr/local/mysql/
./mysqld_safe --user=mysql
/usr/local/mysql/bin/mysql 连接测试
3、编译安装php
tar -jxvf php-5.2.9.tar.bz2 -C /usr/local/src
cp php-5.2.8-fpm-0.5.10.diff.gz /usr/local/src
cd /usr/local/src
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.9/ -p1
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql/ --enable-fastcgi --enable-fpm
make && make install
cp php.ini-dist /usr/local/php/php.ini
4、配置
vim /usr/local/php/etc/php-fpm.conf
Unix user of processes
nobody
Unix group of processes
nobody
5、让nginx支持php
编辑nginx的配置文件
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
root /scripts;
if (-f $request_filename) {
expires 1d;
break;
}
}
接下来,启动nginx服务。
/usr/local/nginx/sbin/nginx
到此为止,Nginx+PHP已经配置完成。
tar -zxvf nginx-1.0.9.tar.gz -C /usr/local/src
./configure --prefix=/usr/local/nginx109 --with-http_stub_status_module --with-http_ssl_module --user=nginx --group=nginx
make && make install
/usr/local/nginx/sbin/nginx start
netstat -anplt | grep :80
elinks 127.0.0.1
2、编译安装mysql
tar -xzvf mysql-mysql-5.1.34.tar.gz -C /usr/local/src
如果不存在mysql 用户,则建立之
./configure --prefix=/usr/local/mysql
make && make install
rm -rf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db
chown -R mysql: mysql /usr/local/mysql/
./mysqld_safe --user=mysql
/usr/local/mysql/bin/mysql 连接测试
3、编译安装php
tar -jxvf php-5.2.9.tar.bz2 -C /usr/local/src
cp php-5.2.8-fpm-0.5.10.diff.gz /usr/local/src
cd /usr/local/src
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.9/ -p1
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql/ --enable-fastcgi --enable-fpm
make && make install
cp php.ini-dist /usr/local/php/php.ini
4、配置
vim /usr/local/php/etc/php-fpm.conf
Unix user of processes
nobody
Unix group of processes
nobody
5、让nginx支持php
编辑nginx的配置文件
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
root /scripts;
if (-f $request_filename) {
expires 1d;
break;
}
}
接下来,启动nginx服务。
/usr/local/nginx/sbin/nginx
到此为止,Nginx+PHP已经配置完成。