搭建nginx+php-fpm+php服务遇到的问题
来源:互联网 发布:淘宝美工班 编辑:程序博客网 时间:2024/06/07 01:00
a.php-fpm配置文件修改(php-fpm.conf)
cp php-fpm.conf.default php-fpm.conf
vi php-fpm.conf
去掉 ;pid = run/php-fpm.pid中的“;”
b.www.conf配置文件修改(www.conf)
cp www.conf.defalut www.conf
vi www.conf
将user和group的nobody修改为www-data
c.php.ini修改
将;cgi.fix_pathinfo=1修改为cgi.fix_pathinfo=0(去掉这行“;不然SCRIPT_FILENAME这个变量无法使用”默认值为1,是为了防止当文件不存在的时,阻止Nginx将请求发送到后端的PHP-FPM模块,从而避免恶意脚本注入攻击)
d.nginx.conf配置文件的修改
这个地方默认是被注释掉的,去掉注释同时将/script$fastcgi_script_name修改为$document_root$fastcgi_script_name(不修改的话在你访问index.php的时候会显示File not found.)
这里也可以这样做修改 :
因此不再建议大家使用以下方式(搜了一下,网上大量的文章,并且nginx.conf的默认配置也是使用这种方式):
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
而使用最新的方式:
include fastcgi.conf;
将第一行的user nobody修改为user www-data
在上图中的地方添加index.php
如果不是在root权限下面的话,记得修改nginx的端口号(1024以下的端口号都是在root权限下的),不然无法启动nginx
启动nginx遇到的问题“the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /opt/nginx/conf/nginx.conf:1”
问题出现的原因:nginx的主进程启动是需要root权限的 可解决的办法:修改nginx文件的权限
- 搭建nginx+php-fpm+php服务遇到的问题
- Nginx+PHP-FPM环境搭建
- nginx+php-fpm环境搭建
- nginx+php-fpm遇到的502报错
- nginx+php-fpm遇到的502报错
- 浅谈初次搭建nginx+php+mysql遇到的问题
- 2016年搭建nginx+php+mysql遇到的一些问题
- LNMP搭建(Ubuntu10.04+Nginx+PHP-FPM)
- ubuntu搭建 nginx+php7+php-fpm+mysql
- docker搭建nginx+php-fpm开发环境
- centos7安装php7 php-fpm nginx mariadb及解决php7与php-fpm冲突的问题
- fcgi4j与PHP-FPM通信遇到的问题
- Nginx + PHP(php-fpm)遇到的502 Bad Gateway错误
- nginx php-fpm内存配置问题
- nginx + php-fpm Connection refused问题
- Nginx+php-fpm 502 504问题
- Nginx+php-fpm 502 504问题
- Nginx+php-fpm 502 504问题
- matlab hist函数的用法
- docker service tasks “new” states
- lingo入门教程之三 --- 文件数据处理
- ESP8266--学习笔记(零)学习ESP8266常用软件
- google账号注册(解决收不到验证码的问题)
- 搭建nginx+php-fpm+php服务遇到的问题
- 斐波那契数列--计算前后缀
- cat /proc/pid/statm
- c 迷惑1
- 【树状数组】poj2299 Ultra-QuickSort(离散化+树状数组求逆序数)
- Web Services基础知识
- 5-28 猴子选大王 (20分)
- PAT甲1020
- Kaggle : Using a Convolutional Neural Network for classifying Cats vs Dogs