老男人百科 > 百科 > 正文

apache禁止目录浏览(nginx实现禁止ip访问)

2023-05-11 16:21:38 阅读( 3478)

1.IIS实现方法

1.iis实现方法IIS、Apache、Nginx禁止目录执行php脚本方法

IIS比较简单,如图设置即可。

2.Apache实现方法

方法一

Directory '/var/www/html/attachments'

Files ~ '.php'

Order allow,deny

Deny from all

/Files

/Directory

方法2

Directory '/var/www/html/attachments'

php_admin_flag engine off

/Directory

方法3

写进去。htaccess

RewriteEngine on RewriteCond % !^$

RewriteRule attachments/(.*).(php)$ - [F]

3.nginx实现方法

location ~ /attachments/.*\.php$ {

deny all;

}

专题页