详解:centos下配置nginx支持php

Crq
Crq
管理员
1686
文章
0
粉丝
Linux教程评论39字数 191阅读0分38秒阅读模式
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

weinxin
我的微信
微信号已复制
我的微信
这是我的微信扫一扫
 
Crq
  • 本文由 Crq 发表于2024年9月26日 17:06:37
  • 转载请注明:https://www.cncrq.com/10908.html
K8S学习你需要掌握的知识! Linux教程

K8S学习你需要掌握的知识!

通过kubectl命令可以操作和管理K8S资源,对于初学者可以在掌握K8S基础命令的基础上再去学习K8s的原理和架构,那么K8S常用的命令有哪些呢?来看一下吧。
如何向云计算迁移 Linux教程

如何向云计算迁移

在企业里,许多向云计算迁移成功的案例,都是先从一些较为简单的应用开始迁移,然后再一步步把更多的应用和数据迁移到云,不可能同时把所有的应用都一下迁移过去。上云迁移的过程,我们可以将其...
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证