详解:centos下配置nginx支持php

Crq
Crq
Crq
553
文章
0
评论
2024年9月26日17:06:37
评论
8 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
运维稳定性问题的关键–可用性 Linux教程

运维稳定性问题的关键–可用性

复盘更多的是基于事后的总结与提升。那么我们如何发现、测量稳定性问题呢?那么我们就需要请出今天的主角了——可用性。 什么是可用性? 可用性作为评价业务稳定性的一个重要指标,它可以通过数据量化、建立基线的...
如何在Linux系统上添加新的磁盘 Linux教程

如何在Linux系统上添加新的磁盘

作为一个系统管理员,我们会有这样的一些需求:作为升级服务器容量的一部分,或者有时出现磁盘故障时更换磁盘,我们需要将新的硬盘配置到现有服务器。 在这篇文章中,我会向你逐步介绍添加新硬...
Ubuntu终端常用快捷键 Linux教程

Ubuntu终端常用快捷键

Ubuntu是一个非常好用的linux开发版系统,本文收集整理了一些Ubuntu常用的一些快捷键,Ubuntu中的许多操作在终端(Terminal)中十分的快捷,记住一些快捷键的操...
详解命令-GCC Linux教程

详解命令-GCC

gcc命令使用GNU推出的基于C/C++的编译器,是开放源代码领域应用最广泛的编译器,具有功能强大,编译代码支持性能优化等特点。现在很多程序员都应用GCC,怎样才能更好的应用GCC...
匿名

发表评论

匿名网友 填写信息

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