如何配置NGINX的CONF文件不支持PHP。
装的LNMP安装包。。。将站点的CONF文件中的include enable-php.conf; 删掉,重启NGINX后。。是不支持PHP了。但是在访问站点中的PHP文件时提示下载这个PHP文件能不能不让他下载。站点只支持纯HTML和JPG等格式的图片文件呢。
不让解析php肯定会提示下载,如果访问php文件你想达到什么效果? admin 发表于 2019-5-13 10:06
不让解析php肯定会提示下载,如果访问php文件你想达到什么效果?
访问PHP。报错能行吗。不让这个站点访关任何PHP文件。只能访问HTML和JPG等图片文件。不能占用资源
admin 发表于 2019-5-13 10:06
不让解析php肯定会提示下载,如果访问php文件你想达到什么效果?
感谢回复。
location ~ .*\.php$
{
return 403;
} admin 发表于 2019-5-13 12:49
location ~ .*\.php$
{
return 403;
我的现在是这个。你说的要加到哪里。
server
{
listen 80;
#listen [::]:80;
server_name pic.1434324324.com;
root/home/pic.1434324324.com;
include none.conf;
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log off;
server
{
listen 80;
#listen [::]:80;
server_name pic.1434324324.com;
root/home/pic.1434324324.com;
include none.conf;
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
location ~ .*\.php$
{
return 403;
}
access_log off; admin 发表于 2019-5-13 14:31
server
{
listen 80;
我直接在虚拟机的nginx.conf里改的。加入那条后。PHP还是可以正常访问。
不应该啊
页:
[1]