Install Nginx, PHP5, PHP-FPM and MySQL on Ubuntu 11.04:
1. Install MySQL
sudo apt-get install mysql-server
sudo apt-get install mysql-server mysql-client
2. Install nginx
(1) Add nginx ppa source in sources.list:
sudo vim /etc/apt/sources.list
deb http://ppa.launchpad.net/nginx/development/ubuntu maverick main
deb-src http://ppa.launchpad.net/nginx/development/ubuntu maverick main
(2) add key, and then update
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys C300EE8C
sudo apt-get update
(3) Install nginx
sudo apt-get install nginx
3. Install php and php-fpm
(1) Create directory
sudo mkdir /var/www
(2) installation
sudo apt-get install php5-cgi php5-mysql php5-fpm php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
4. Configuration
(1) Modify php.ini
sudo vim /etc/php5/fpm/php.ini
Change cgi.fix_pathinfo=1
INTO cgi.fix_pathinfo=0
(2) Modify /etc/nginx/sites-available/default
sudo vim /etc/nginx/sites-available/default
server {
listen [::]:80 default ipv6only=on;
listen 80;
server_name localhost;
root /var/www/;#access_log /var/www/log/xxx-access.log;
#error_log /var/www/logs/xxx-error.log;location / {
index index.php index.html index.htm;
}#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www/nginx-default;
#}location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
(3) Edit /etc/nginx/fastcgi_params, add the following line at the end:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
5. Start nginx and php-fpm
sudo /etc/init.d/nginx restart
sudo /etc/init.d/php5-fpm reload
http://turbolinux.org/2011/05/install-nginx-php5-php-fpm-and-mysql-on-ubuntu-11-04/