首页 > Web开发 > 详细

Apache安全<一>

时间:2017-09-27 00:33:13      阅读:252      评论:0      收藏:0      [点我收藏+]

Apache安全

1、权限最小化

  Apache用户只能用Apache用户去执行

查看ps -ef | grep http

 

2、确保只有root用户可以修改Web根目录下的文件

chown root:root /var/www/html

find /var/www/html -type f -exec chmod 644 {} \;

find /var/www/html type d -exec chmod 755 {} \;

 

3、开启Apache的日志记录功能,记录客户端IP、访问时间、请求页面、发送字节数、Agent等信息。

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

CustomLog logs/access_log combined

可以根据情况修改LogFormat,记录需要的信息。

 

4自定义错误信息

参考配置操作

建立错误页面400.html401.html402.html403.html404.html等,在httpd.conf添加

ErrorDocument 400 /error/400.html

ErrorDocument 401 /error/401.html

ErrorDocument 402 /error/402.html

ErrorDocument 403 /error/403.html

ErrorDocument 404 /error/404.html

 

5、只允许部分IP访问网站的敏感目录。

参考配置操作

<Directory "/var/www/html/admin">

    Order allow,deny

    Allow from 192.168.0.0/255.255.255.0

</Directory>

 

6、禁用Apache的目录浏览功能

参考配置操作

如以下配置

<Directory "/var/www/html">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

改为

Options -Indexes FollowSymLinks

 

 

==============================================================

作者:compy    更新日期:2017-09-26 23:57    Q群:627806889

==============================================================

Apache安全<一>

原文:http://www.cnblogs.com/cslzzl/p/7599653.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!