-3

我正在使用 linux box 和 php。我安排了许多 cron 任务。如果有人直接尝试使用浏览器访问这些文件,我想阻止访问这些文件。我该怎么做呢。

4

3 回答 3

3
  • 不要将文件放在网络根目录下
  • 需要身份验证/授权
  • 通过 IP 地址限制访问
于 2013-02-04T11:03:41.830 回答
1

使用.htaccess的示例解决方案:

<Files "cronjobs.php">
  Order deny,allow
  Allow from allowedmachine.com
  Allow from localhost
  Deny from all
</Files>
于 2013-02-04T11:13:53.790 回答
0

也许这个?[来源]:https ://github.com/h5bp/html5-boilerplate/blob/master/.htaccess

# "-Indexes" will have Apache block users from browsing folders without a
# default document Usually you should leave this activated, because you
# shouldn't allow everybody to surf through every folder on your server (which
# includes rather private places like CMS system folders).
<IfModule mod_autoindex.c>
  Options -Indexes
</IfModule>
于 2013-02-04T11:08:59.733 回答