详解:centos下配置nginx支持php

Crq
Crq
Crq
1166
文章
0
评论
2024年9月26日17:06:37
评论
17 891字阅读2分58秒
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
  • 本文由 发表于 2024年9月26日17:06:37
  • 转载请注明:https://www.cncrq.com/10908.html
初识puppet Linux教程

初识puppet

puppet 是一种Linux、Unix 平台的集中配置管理系统,使用自有的puppet 描述语言,可管理配置文件、用户、cron 任务、软件包、系统服务等。puppet 把这些系...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: