1,让MySQL支持PHP5,我们可以安装php5-mysql包。其余的包,我们可以按需安装所需要的包,用apt-cache search php5列出PHP的包,看下那个是你所需要的。
2,选择一些你所需要的包,象这样安装:
apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
3,重启PHP-FPM
/etc/init.d/php5-fpm restart
4,打开浏览器,输入http://127.0.0.1/info.php,看下你安装的包是不是已经被支持了。
七:配置PHP-FPM, vim /etc/php5/fpm/php-fpm.conf 或在 vim /etc/php5/fpm/conf.d/下做更详细的配置,不懂真人的默认就行了 ,也不优化了。
八:在/etc/nginx/sites-available/default中新增一个虚拟主机,看下效果。
我的配置文件:
server {
listen 80 ; ## listen for ipv4; this line is default and implied
# listen [::]:80 default ipv6only=on; ## listen for ipv6
root /web/example;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name 218.198.177.252 example.com ; //这个和apache一样的啦,写域名就行了
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
# Only for nginx-naxsi : process denied requests
#location /RequestDenied {
# For example, return an error code
#return 418;
#}
#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 /web/example;
}
location ~ \.php$ { //nginx处理静态的页面,动态的转给FastCGI处理
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
如过你的不成功,自己检查下....
