Debian 6(squeeze) 64bit安装Nginx+php-fpm

Debian 6(squeeze) 64bit安装Nginx+php-fpm

作者:admin 时间:2012-03-20 分类:服务器 网站开发 评论:0条 浏览:1872

编辑软件源:
vim /etc/apt/sources.list
添加:
deb http://packages.dotdeb.org stable all
导入密钥:
wget http://www.dotdeb.org/dotdeb.gpg
cat dotdeb.gpg | sudo apt-key add –
rm dotdeb.gpg
更新系统:
apt-get update
安装nginx、php、php-fpm
apt-get install nginx php5 php5-fpm php-pear php5-common php5-mcrypt php5-mysql php5-cli php5-gd
配置fpm
vim /etc/php5/fpm/php5-fpm.conf
添加/修改以下参数(适合512MB-1GB VPS):
pm.max_children = 25
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 500
request_terminate_timeout = 30s
重启fpm
/etc/init.d/php5-fpm restart
配置nginx
vim /etc/nginx/nginx.conf
添加/修改以下参数:
client_max_body_size 20M;
client_body_buffer_size 128k;
删除默认虚拟主机:
cd /etc/nginx/sites-enabled
rm default
创建一个全新的主机:
vim /etc/nginx/sites-available/www.website.com
添加主机信息:
server {
listen 80;
server_name website.com www.website.com;
access_log /var/log/nginx/website.access_log;
error_log /var/log/nginx/website.error_log;
root /var/www/www.website.com;
index index.php index.htm index.html;
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/www.website.com$fastcgi_script_name;
include fastcgi_params;
}
}
建立软链接,启用这个网站:
ln -s /etc/nginx/sites-available/www.website.com /etc/nginx/sites-enabled/www.website.com
重启nginx:
/etc/init.d/nginx restart

原文:https://www.store.ipcoders.com/knowledgebase/12/How-To-Nginx-plus-php-fpm-on-Debian-Squeeze.html

原创文章,转载请注明: 转载自www.webmaster.me

本文链接地址: Debian 6(squeeze) 64bit安装Nginx+php-fpm

相关推荐
更多

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*