在CentOS/RHEL6.2/5.8,Fedora17/16上安装Nginx/PHP-FPM环境
本文将介绍如何在Fedora17/16/15/14,CentOS6.2/6.1/6/5.8及Red Hat(RHEL)6.2/6.1/6/5.8上安装配置Nginx/PHP-FPM。
什么是Nginx
Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。
在Fedora17/16/15/14,CentOS6.2/6.1/6/5.8及Red Hat(RHEL)6.2/6.1/6/5.8上安装配置Nginx/PHP-FPM
让我们开始行动起来吧
STEP1.切换到root用户
su - ## OR ## sudo -i
STEP2.安装必要的软件源
2-1. Fedora 17/16/15/14 下安装Remi源
## Remi Dependency on Fedora 17, 16, 15 rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm ## Fedora 17 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm ## Fedora 16 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm ## Fedora 15 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm ## Fedora 14 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm
2-1. CentOS 6.2/6.1/6/5.8 及 Red Hat (RHEL) 6.2/6.1//6/5.8下安装Remi源
## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ## rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm ## CentOS 6 and Red Hat (RHEL) 6 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm ## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ## rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm ## CentOS 5 and Red Hat (RHEL) 5 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
2-2. CentOS 6.2/6.1/6/5.8 及 Red Hat (RHEL) 6.2/6.1/6/5.8 下还要配置Nginx 源
创建/etc/yum.repos.d/nginx.repo文件并写入以下内容
CentOS
RedHat(RHEL)
[nginx] name=nginx repo baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/ gpgcheck=0 enabled=1
STEP3.安装Nginx,PHP5.4.4&PHP-FPM
3-1. Fedora 17/16/15/14下
yum --enablerepo=remi install nginx php php-fpm php-common
3-1. CentOS 6.2/5.8 及 Red Hat (RHEL) 6.2/5.8下
yum --enablerepo=remi,remi-test install nginx php php-fpm php-common
STEP4.安装PHP5.4.4模块扩展
- APC (php-pecl-apc) – APC缓存优化中间件
- CLI (php-cli) – PHP命令行插件
- PEAR (php-pear) – PHP官方扩展
- PDO (php-pdo) – 数据库PDO扩展
- MySQL (php-mysql) –MYSQL驱动
- PostgreSQL (php-pgsql) – PostgreSQL驱动
- MongoDB (php-pecl-mongo) – PHP MongoDB驱动
- SQLite (php-sqlite) – SQLite V2引擎及驱动
- Memcache (php-pecl-memcache) – Memcache 驱动
- Memcached (php-pecl-memcached) – Memcached 驱动
- GD (php-gd) – GD图片类库扩展
- XML (php-xml) –XML扩展
- MBString (php-mbstring) –多字节字符串处理扩展
- MCrypt (php-mcrypt) – MCrypt类库扩展
4-1. Fedora 17/16/15/14下使用命令:
4-1. CentOS 6.2/5.8 and Red Hat (RHEL) 6.2/5.8下使用命令: