centos7卸载和安装php7并且部署在nginx上

2017-06-16  本文已影响362人  MJ爱运动

安装php

yum remove php* php-common

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64

yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64

yum install php70w-fpm

yum install php56w-fpm

php -v

配置nginx

配置一个站点
 server {
        listen 2333;
        root /data/projectName/public;
        access_log  /var/log/nginx/2333.port.log;
        error_log   /var/log/nginx/2333.port.error.log;
        index index.php;
        location / {
                        try_files $uri $uri/ /index.php?$query_string;
                }
        location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
     }

上一篇下一篇

猜你喜欢

热点阅读