php 5.3.3 如何装php-fpm,Ubuntu/Debian如何快速安装PHP-fpm 5.3和Nginx

大家都知道在安装PHP-fpm 5.3和Nginx的时候需要我们浪费很多时间,那么为了节省时间很多用户们都会想快速安装,那么你知道Ubuntu/Debian如何快速安装PHP-fpm 5.3和Nginx吗?

1、安装Nginx

Nginx版本不需要太新,用官方源里的就很好,起码够稳定

sudo apt-get install nginx简单编辑下它的默认配置,一会儿来测试能否与PHP正常的工作

sudo vim /etc/nginx/sites-available/default改完后它看起来差不多是这个样子

server {

listen   80;

server_name  localhost;

access_log  /var/log/nginx/localhost.access.log;

## Default location

location / {

root   /var/www;

index  index.php;

}

## Images and static content is treated different

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {

access_log        off;

expires           30d;

root /var/www;

}

## Parse all .php file in the /var/www directory

location ~ .php$ {

fastcgi_split_path_info ^(.+\.php)(.*)$;

fastcgi_pass   backend;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;

include fastcgi_params;

fastcgi_param  QUERY_STRING     $query_string;

fastcgi_param  REQUEST_METHOD   $request_method;

fastcgi_param  CONTENT_TYPE     $content_type;

fastcgi_param  CONTENT_LENGTH   $content_length;

fastcgi_intercept_errors        on;

fastcgi_ignore_client_abort     off;

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;

}

## Disable viewing .htaccess & .htpassword

location ~ /\.ht {

deny  all;

}

}

2、准备工作

如果用的是Ubuntu系统的话需要手动安装两个包、Debian则不需要

cd /tmp

wget http://us.archive.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb53_1.6.dfsg.4~beta1-5ubuntu2_i386.deb

wget http://us.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8-6ubuntu0.2_i386.deb

sudo dpkg -i *.deb如果用的amd64的系统请将以上两个包中的i386改为amd64

3、添加非官方源,安装PHP-fpm

sudo echo "deb http://php53.dotdeb.org stable all" >> /etc/apt/sources.list更新源

sudo apt-get update安装PHP环境

sudo apt-get install php5-cli php5-common php5-suhosin上面安装的是CLI的PHP,接下来安装CGI、fpm

sudo apt-get install php5-fpm php5-cgi需要其他的模块或者扩展可以自行安装,这里列举下这个源里提供的所有模块与扩展

php5-curl_5.3.2-0.dotdeb.1_i386.deb

php5-dbg_5.3.2-0.dotdeb.1_i386.deb

php5-dev_5.3.2-0.dotdeb.1_i386.deb

php5-enchant_5.3.2-0.dotdeb.1_i386.deb

php5-fpm_5.3.2-0.dotdeb.1_i386.deb

php5-gd_5.3.2-0.dotdeb.1_i386.deb

php5-gmp_5.3.2-0.dotdeb.1_i386.deb

php5-imap_5.3.2-0.dotdeb.1_i386.deb

php5-interbase_5.3.2-0.dotdeb.1_i386.deb

php5-ldap_5.3.2-0.dotdeb.1_i386.deb

php5-mcrypt_5.3.2-0.dotdeb.1_i386.deb

php5-mysql_5.3.2-0.dotdeb.1_i386.deb

php5-odbc_5.3.2-0.dotdeb.1_i386.deb

php5-pgsql_5.3.2-0.dotdeb.1_i386.deb

php5-pspell_5.3.2-0.dotdeb.1_i386.deb

php5-recode_5.3.2-0.dotdeb.1_i386.deb

php5-snmp_5.3.2-0.dotdeb.1_i386.deb

php5-sqlite_5.3.2-0.dotdeb.1_i386.deb

php5-sybase_5.3.2-0.dotdeb.1_i386.deb

php5-tidy_5.3.2-0.dotdeb.1_i386.deb

php5-xmlrpc_5.3.2-0.dotdeb.1_i386.deb

php5-xsl_5.3.2-0.dotdeb.1_i386.deb

php5_5.3.2-0.dotdeb.1_all.deb

php5-apc_5.3.2-0.dotdeb.1_i386.deb

php5-ffmpeg_5.3.2-0.dotdeb.1_i386.deb

php5-geoip_5.3.2-0.dotdeb.1_i386.deb

php5-http_5.3.2-0.dotdeb.1_i386.deb

php5-imagick_5.3.2-0.dotdeb.1_i386.deb

php5-memcache_5.3.2-0.dotdeb.1_i386.deb

php5-spplus_5.3.2-0.dotdeb.1_i386.deb

php5-ssh2_5.3.2-0.dotdeb.1_i386.deb

php5-suhosin_5.3.2-0.dotdeb.1_i386.deb

php5-xcache_5.3.2-0.dotdeb.1_i386.deb

php5-xdebug_5.3.2-0.dotdeb.1_i386.deb

4、测试运行

启动Nginx与PHP-Fpm

sudo /etc/init.d/nginx restart

sudo /etc/init.d/php5-fpm restart接下来在/var/www/下建立个index.php文件,然后写入PHP的测试函数

然后访问,出现PHP环境信息则表示运行正常

查看错误信息

sudo tail /var/log/nginx/error.log

上文就是小编根据自己的经验为大家分享的Ubuntu/Debian如何快速安装PHP-fpm 5.3和Nginx的内容,希望本文能给大家带来一定的帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值