Method one, nginx limit suffix
Solution:
The code is as follows |
|
Location ~*. (Txt|doc|sql|gz) $ { if (-f $request _filename) { Break } } |
The code above restricts the TXT doc sql gz filename suffix from being accessed if requested to jump out.
Of course, if you want to be more stringent, it can also use the following:
The code is as follows |
|
Location ~*. (Txt|doc|sql|gz) $ { Deny all; } |
This completely disables access to the TXT doc sql gz file suffix. Look at everyone's own choice.
Method Two, today I thought of another method of restriction (System: CentOS 5.9)
code is as follows |
&nbs P; |
Server { listen; &nb Sp server_name www.111cn.net; root/var/www/vhosts/www.111cn.net; Location/ { index index.php; set $is _php ' no '; if (!-f $request _filename) { set $is _php ' yes '; } if ($request _filename ~ (. php.*)) { set $is _php ' yes '; } if ($is _php ~ ^no$) { return 404; } } Access_log/var/log/www/blog.slogra.com.access.log; } |
Summary
Nginx If you do not allow PHP support we can configure the environment is not configured PHP environment can be, this is better solved, if the configuration of the PHP environment we can directly delete the PHP environment.