Centos 7 通过YUM安装 PHP7 NGINX1.1.8 POSTGRESQL9.5

转载

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

12添加路由

On CentOS 7 systems:

firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload

13 更改数据库密码

su - postgres
psql

.. and set postgres password with following command:

postgres=# password postgres 
Enter new password: 
Enter it again: 
postgres=# q
 
原文地址:https://www.cnblogs.com/xiejc/p/5210165.html