当前位置:首页 » 编程语言 » nginx无法解析php

nginx无法解析php

发布时间: 2025-03-04 11:10:49

A. nginx php文件不能正常访问.

一般nginx默认配置中会是这个样子的。这里有一个SCRIPT_FILENAME变量,但是fastcgi_params这个文件中是不包含该变量的,改变量的定义实际上是在fastcgi.conf文件中。

实际上可以把配置修改成如下的配置。

location~.php${
root/usr/share/nginx/html;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_intercept_errorson;
includefast_cgi.conf;

#可以增加rewrite,也可以不增加。
}

按如上的配置,如果访问127.0.0.1:9000/a.php,则实际上根据root指令和fast_cgi.conf配置,nginx会通过fast_pass指令访问/usr/share/nginx/html/a.php这个文件。

记得用root指令,指定站点的文档根路径。

B. nginx 根文档目录的子目录 为什么不能自动解析index.php

nginx 根文档目录的子目录 自动解析index,php
1location ~ ^/upload/.*\.(php|php5)$
{
deny all;
}

其中upload换为你要设置的目录名字

这条规则的含义是匹配请求连接中开头是/upload/,中间匹配任意字符,结尾匹配.php或者.php5的页面,最后利用deny all禁止访问!

热点内容
数据上传网络 发布:2025-05-01 22:18:02 浏览:693
火萤安卓版怎么设置锁屏 发布:2025-05-01 22:12:42 浏览:720
iphone4访问限制是什么 发布:2025-05-01 21:58:51 浏览:463
工商银行电子密码器多少钱 发布:2025-05-01 21:57:15 浏览:978
电信手机打电话显示无法访问移动网络 发布:2025-05-01 21:48:45 浏览:449
idc服务器搭建 发布:2025-05-01 21:45:30 浏览:175
unit哪个配置有机甲绿 发布:2025-05-01 21:17:41 浏览:577
java提交 发布:2025-05-01 21:16:55 浏览:446
linux僵死 发布:2025-05-01 21:10:25 浏览:42
php套盒 发布:2025-05-01 21:08:02 浏览:215