Ubuntu 11.10编译安装Nginx、PHP 5.3.8、MySQL、MongoDB、

手动编译安装nginx 1.0.5

nginx下载页面:http://nginx.org/en/download.html

手动安装mysql

手动编译安装php 5.3.8

php下载页面:http://php.net/downloads.php

常用扩展:curl、pdo、pdo-mysql、mysqli、openssl、gd、jpeg、png、exif、zip、magickwand

sudo apt-get install libltdl-dev libssl-dev sendmail libjpeg8 libjpeg8-dev libpng12-0  libpng12-dev libxml2-dev libcurl4-openssl-dev libmcrypt-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libpng* /usr/lib/
echo 根据PHP官方推荐,使用mysqli和pdo_mysql,而不使用mysql。gmail stmp需要openssl。
wget http://cn2.php.net/get/php-5.3.8.tar.bz2/from/this/mirror
tar -jxvf php-5.3.8.tar.bz2
cd php-5.3.8
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-curl --with-mcrypt --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-openssl --with-imap-ssl --with-gd --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/ --enable-exif --enable-zip
make
sudo make install
sudo cp php.ini-development /usr/local/php/lib/php.ini
sudo ln -s /usr/local/php/bin/php /usr/bin/php
sudo cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
sudo vi /usr/local/php/etc/php-fpm.conf
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
pm.start_servers
pm.min_spare_servers
pm.max_spare_servers

sudo cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
sudo chmod 755 /etc/init.d/php-fpm
echo 把php-fpm加入服务,开机自启动
sudo update-rc.d php-fpm defaults
sudo /usr/local/php/sbin/php-fpm
sudo vi /usr/local/nginx/conf/nginx.conf
location / {

root /usr/www;

index index.html index.htm index.php;

}

location ~ \.php$ {

root /usr/www;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

include fastcgi_params;

}

sudo killall nginx

sudo /etc/init.d/nginx

相关推荐