虚拟化容器,大数据,DBA,中间件,监控。

Centos5.6 yum 安装nginx+PHP-FPM+eAccelerator+mysql

13 02月
作者:admin|分类:DBA运维
Centos5.6 yum 安装nginx+PHP-FPM+eAccelerator+mysql

安装centos 5.6

选择需要的软件,但不要安装系统安装盘(iso)带的php.

我不喜欢纯字符的linux,还是希望有必要的GUI程序,所以在安装centos时,选择了安装gnome,特别是一定安装 firefox、文本编辑器、服务管理。。。。

另外,选择安装mysql,不要安装apache。

 

安装 nginx php php-fpm eaccelerator

============================ 

 添加[CentALT]源
 在/etc/yum.repo.d 目下创建 alt.ru.repo 文件内容如下:

[CentALT]
name=CentALT Packages for Enterprise Linux 5 - $basearch
baseurl=http://centos.alt.ru/repository/centos/5/$basearch/
enabled=1
gpgcheck=0

======================================

启用 EPEL

64位系统使用下面命令:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

32系统的用下面命令
rpm -Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

=================================

执行:
yum update
yum install nginx php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php php-eaccelerator

系统自动会选择php5.2.17 相关包和模块

=========================================

安到这里,原以为都会没问题了,其实还有很多问题呢。。。。。。。

 

启动服务:

打开服务管理软件(系统->管理->服务),选中nginx作为后台服务,启动nginx;   选中php-fpm作为系统服务并启动。


打开firefox,访问 http://127.0.0.1 ,见到nginx欢迎界面,静态网页没问题了,php呢?

在此时ngnix 80端口指向的目录,  /usr/share/nginx/html 中添加一个建的的php文件,phpinfo.php,内容如下:

<?php

echo phpinfo();

?>

访问 http://127.0.0.1/phpinfo.php 根本不认识php文件。。。

 

更改nginx.conf, 先不考虑优化,先让php跑起来。

修改 /etc/nginx/nginx.conf, 找到:

        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

把这段的#号都去掉。再访问  http://127.0.0.1/phpinfo.php ,出现 No input file specified.

将 fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

改为:fastcgi_param   SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
再访问 http://127.0.0.1/phpinfo.php

如果遇到“Access denied”, 就打开"终端",执行    chmod 777 /usr/share/nginx/html -R

再访问 http://127.0.0.1/phpinfo.php  终于见到phpinfo了。

可以看到 php-fpm eaccelerator都安装好了。

好了,装好了,如果还想优化 nginx php-fpm 的配置,网上有很多文章。


浏览5121 评论0
返回
目录
返回
首页
完美安装 CentOS + Nginx + PHP-FPM + MySQL 海蜘蜘 永久免费海蜘蛛 ISP 6.1.8纯净无后门版