centos安装php7.1和nginx注意事项

centos安装php7.18注意

报错–php53-common conflicts with php-common

//解决
yum -y install php*   --skip-broken 

第一步:安装源

yum install epel-release

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

第二步:安装PHP的组件

yum install php71w php71w-mysql php71w-odbc php71w-common php71w-embedded php71w-pgsql php71w-xml  php71w-ldap php71w-fpm php71w-gd php71w-pdo php71w-devel php71w-mbstring php71w-mcrypt php71w-cli php71w-json php71w-imap php71w-bcmath mod_php71w php71w-pear

第三步:查看安装完的状态

 rpm -qa |grep php

第四步:查找安装路径

whereis php-fpm

php-fpm: /usr/sbin/php-fpm /etc/php-fpm.conf /etc/php-fpm.d /usr/share/man/man8/php-fpm.8.gz

第五步:启动PHP服务

service php-fpm start

第六步:查看服务端口是否已启动

netstat -lnt | grep 9000

tcp 0 0 127.0.0.1:9000 0.0.0.0: LISTEN*

第七步:加入自启动

chkconfig php-fpm on

第八步:关闭服务

service php-fpm stop

第九步:安装nginx

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
//查看
yum info nginx
//安装
yum install nginx
//启动
service nginx start

第十步:配置虚拟主机
1、在nginx目录下找到nginx.conf。
2、在http {}里面的最后,添加如下行

include vhosts/*.conf;

3、在niginx目录下创建(mkdir)一个vhosts文件
4、在vhosts文件里vim一个nginx.conf文件

server {
        listen       80;
        server_name  www.sh.com sh.com;
        root   /home/zhangwenzong/rxyx-dev;
        location / {
            index  index.html index.htm index.php;
            #autoindex  on;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
}

若报错File not found
chmod -R 777 zhangwenzong

若pdo等拓展失效运行第二步可以了

你可能感兴趣的:(linux)