debian6.0.4下安装nginx+mysql+php-fpm,在虚拟机中测试成功。
1、在/etc/apt/sources.list中添加nginx及php-fpm的源:
deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all
下载并添加dotdeb的gpg:
wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | apt-key add -
2、安装nginx、php-fpm、mysql:
apt-get install nginx php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming mysql-server
3、修改nginx配置文件,支持php:
vi /etc/nginx/conf.d/default.conf
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
#location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; # include fastcgi_params; #}
删除上面蓝色字体字符及前面的#号,红色字体为网站目录。
4、重启nginx:
service nginx restart
debian安装网站程序比其他系统方便的地方,nginx、php和mysql安装完成后,自动启动并加入系统启动中。