分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

Apache安全<一>

发布时间:2023-09-06 01:14责任编辑:董明明关键词:暂无标签

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.html、401.html、402.html、403.html、404.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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved