首页 > 技术文章 > centos7 通过YUM安装 PHP7 NGINX1.1.8 POSTGRESQL9.5

wangyanlb 2015-09-22 16:32 原文

CENTOS的策略实在是太保守了,现在PHP的官方包才5.3  PHP7性能大幅提高,不尝试下对不起自己。

1、最小化安装CENTOS7

2、更新源:

yum update 

reboot 

3.安装扩展源:

yum install epel-release

4.安装工具软件:

yum install wget unzip unrar

5.安装PHP7.0扩展源: 

wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

rpm -Uvh remi-release-7*.rpm

6.安装NGINX扩展源:

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install nginx

7.安装PHP7.0

yum --enablerepo=remi,remi-test install php70-php-fpm

yum --enablerepo=remi,remi-test install php70-php-pgsql php70-php-iconv php70-php-mbstring 

8.安装POSTGRESQL9.5

rpm -i http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-1.noarch.rpm

yum install -y postgresql95-server.x86_64

systemctl enable postgresql-9.5.service

/usr/pgsql-9.5/bin/postgresql95-setup initdb

systemctl start postgresql-9.5.service

9. 编辑NGINX配置文件:

vi  /etc/nginx/conf.d/default.conf

 location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }

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

 

 

10.编辑PHP-FPM 配置文件,将用户修改,可以解决WORDPRESS等在线更新等很多奇怪的问题: 

vi /etc/opt/remi/php70/php-fpm.d/www.conf

user=nginx

 

11.启动服务:

systemctl start nginx
systemctl start php70-php-fpm
systemctl enable nginx
systemctl enable php70-php-fpm

 

更多内容,blog.dazhuang.cc 。如果存在问题,检查一下防火墙的设置。

 

推荐阅读