阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

详解:centos下配置nginx支持php

34次阅读
没有评论

共计 950 个字符,预计需要花费 3 分钟才能阅读完成。

linux install php
yum install php
 
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
添加 nginx 默认主页 index.php
vim /etc/nginx/conf.d/default.conf 

location / {

        root   /usr/share/nginx/html;

        index  index.html index.htm index.php;

    }
配置 nginx 支持 php
vim /etc/nginx/conf.d/default.conf 

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    #

    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;

    }
配置 php-fpm
vim /etc/php-fpm.d/www.conf

; Unix user/group of processes

; Note: The user is mandatory. If the group is not set, the default user's group

;       will be used.

; RPM: apache Choosed to be able to access some dir as httpd

user = nginx

; RPM: Keep a group allowed to write in log dir.

group = nginx
启动服务
chkconfig php-fpm on    #设置 php-fpm 自启动

chkconfig mysqld on     #设置 mysqld 自启动

service nginx restart   #重新启动 nginx

service php-fpm start   #启动 php-fpm

service mysqld start    #启动 mysqld

阿里云 2 核 2G 服务器 3M 带宽 61 元 1 年,有高配

腾讯云新客低至 82 元 / 年,老客户 99 元 / 年

代金券:在阿里云专用满减优惠券

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2024-07-24发表,共计950字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中