sudo apt-get install nginx
安装php
deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main
deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
deb-src http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8D0DC64F
sudo apt-get update
建议先安装
sudo apt-get install mysql-server
必选安装:
sudo apt-get install php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl
可选安装:
sudo apt-get install php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc php5-suhosin php5-odbc php5-ladp
配置nginx,修改/etc/nginx/sites-enabled/default(sites-enabled下的文件是到sites-available目录下文件的符号链接)
location / {
root /var/www/nginx-default;
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include fastcgi_params;
}
参考文章:
整理Ubuntu 10.04 + nginx + php5 + php-fpm安装,并进行多站点配置
http://www.morningprincess.com/Ubuntu-10.04-nginx-php5-php-fpm/
LNMP服务器安装配置详解
http://blog.sina.com.cn/s/blog_48a770da0100pttt.html