当前位置: 首页 > news >正文

android加固apache,Apache安全加固(3)修改httpd.conf文件

1.为Apache使用专门的用户和用户组

默认

#

# If you

wish httpd to run as a different user or group, you must

run

# httpd as

root initially and it will switch.

#

#

User/Group: The name (or #number) of the user/group to run httpd

as.

# . On SCO (ODT 3) use "User nouser" and

"Group nogroup".

# . On HPUX you may not be able to use

shared memory as nobody, and the

# suggested workaround is to create a user www and use that

user.

# NOTE that some kernels refuse to

setgid(Group) or semctl(IPC_SET)

# when the value of (unsigned)Group is

above 60000;

# don't use Group #-1 on these

systems!

#

User

apache

Group

apache

2.限定监听端口

默认

#

# Listen:

Allows you to bind Apache to specific IP addresses

and/or

# ports,

in addition to the default. See also the 《VirtualHost》

#

directive.

#

# Change

this to Listen on specific IP addresses as shown below

to

# prevent

Apache from glomming onto all bound IP addresses

(0.0.0.0)

#

#Listen

12.34.56.78:80

Listen

80

3.限制客户端对服务器资源的消耗

默认

#

# Timeout:

The number of seconds before receives and sends time

out.

#

Timeout

60

#

#

KeepAlive: Whether or not to allow persistent connections (more

than

# one

request per connection). Set to "Off" to deactivate.

#

KeepAlive

Off

#

#

MaxKeepAliveRequests: The maximum number of requests to

allow

# during a

persistent connection. Set to 0 to allow an unlimited

amount.

# We

recommend you leave this number high, for maximum

performance.

#

MaxKeepAliveRequests 100

#

#

KeepAliveTimeout: Number of seconds to wait for the next request

from the

# same

client on the same connection.

#

KeepAliveTimeout 15

4.对客户端进行域名验证

默认

#

#

HostnameLookups: Log the names of clients or just their IP

addresses

# e.g.,

www.apache.org (on) or 204.62.129.132 (off).

# The

default is off because it'd be overall better for the net if

people

# had to

knowingly turn this feature on, since enabling it means

that

# each

client request will result in AT LEAST one lookup request to

the

#

nameserver.

#

HostnameLookups Off

HostnameLookups on|off|double

如果是使用on,那么只有进行一次反查,如果用double,那么进行反查之后还要进行一次正向解析,只有两次的结果互相符合才行,而off就是不进行域名验证

5.修改默认的错误页面

默认

#

#

Customizable error responses come in three flavors:

# 1) plain

text 2) local redirects 3) external redirects

#

# Some

examples:

#ErrorDocument 500 "The server made a boo boo."

#ErrorDocument 404 /missing.html

#ErrorDocument 404 "/cgi-bin/missing_handler.pl"

#ErrorDocument 402

http://www.example.com/subscription_info.html

#

#

# Putting

this all together, we can internationalize error

responses.

#

# We use

Alias to redirect any /error/HTTP_《error》.html.var response to

# our

collection of by-error message multi-language

collections. We use

# includes

to substitute the appropriate text.

#

# You can

modify the messages' appearance without changing any of

the

# default

HTTP_《error》.html.var files by adding the line:

#

# Alias /error/include/

"/your/include/path/"

#

# which

allows you to create your own set of files by starting with

the

#

/var/www/error/include/ files and

# copying

them to /your/include/path/, even on a per-VirtualHost

basis.

#

Alias

/error/ "/var/www/error/"

《IfModule

mod_negotiation.c》

《IfModule

mod_include.c》

《Directory

"/var/www/error"》

AllowOverride None

Options IncludesNoExec

AddOutputFilter Includes html

AddHandler type-map var

Order allow,deny

Allow from all

LanguagePriority en es de fr

ForceLanguagePriority Prefer Fallback

《/Directory》

# ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

# ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

# ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

# ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

# ErrorDocument 405

/error/HTTP_METHOD_NOT_ALLOWED.html.var

# ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

# ErrorDocument 410 /error/HTTP_GONE.html.var

# ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

# ErrorDocument 412

/error/HTTP_PRECONDITION_FAILED.html.var

# ErrorDocument 413

/error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

# ErrorDocument 414

/error/HTTP_REQUEST_URI_TOO_LARGE.html.var

# ErrorDocument 415

/error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

# ErrorDocument 500

/error/HTTP_INTERNAL_SERVER_ERROR.html.var

# ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

# ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

# ErrorDocument 503

/error/HTTP_SERVICE_UNAVAILABLE.html.var

# ErrorDocument 506

/error/HTTP_VARIANT_ALSO_VARIES.html.var

6.默认的日志记录级别

默认:

#

#

LogLevel: Control the number of messages logged to the

error_log.

# Possible

values include: debug, info, notice, warn, error, crit,

# alert,

emerg.

#

LogLevel

warn

相关文章:

  • android初级课程表,模仿大神的一个android课程表
  • html表格 图片 自适应,响应式表格,HTML表格自适应(responsive table)
  • 2021高考成绩微信查询6,湖南6月25日左右公布高考成绩
  • html段落文本,证明段落文本HTML
  • 冯诺依曼计算机主机,冯诺依曼结构计算机包括哪五大部分?
  • map HTML 兼容,HTML map 标签 - HTML 颜色参考手册 - 自强学堂
  • html在id下加标签,html – 标签“for”和输入“id”
  • html5 drag this,HTML5之ondragover,ondrop,ondragstart
  • 计算机应用基础 在线作业 f,计算机应用基础在线作业F.doc
  • 浙江省计算机二级办公软件高级应用等级,浙江省计算机等级考试
  • 计算机网口速率修改,win7系统修改无线网卡连接速率的操作方法
  • 第一年职称计算机考试,2018年职称计算机考试photoshop练习题及答案(1)
  • 老师对计算机课的评语,学生对老师课堂的评语
  • 62比特量子计算机介绍,超车量子计算机!中国破冰62比特量子计算原型机,全球比特数最高...
  • win7调取计算机慢,完美解决win7系统程序反应慢的问题方法介绍
  • 《Javascript高级程序设计 (第三版)》第五章 引用类型
  • 【JavaScript】通过闭包创建具有私有属性的实例对象
  • javascript 哈希表
  • laravel 用artisan创建自己的模板
  • node-glob通配符
  • python大佬养成计划----difflib模块
  • Rancher-k8s加速安装文档
  • spring + angular 实现导出excel
  • SSH 免密登录
  • VirtualBox 安装过程中出现 Running VMs found 错误的解决过程
  • 近期前端发展计划
  • 浏览器缓存机制分析
  • 前端之Sass/Scss实战笔记
  • 详解移动APP与web APP的区别
  • 小试R空间处理新库sf
  • 一个6年java程序员的工作感悟,写给还在迷茫的你
  • 一天一个设计模式之JS实现——适配器模式
  • ​用户画像从0到100的构建思路
  • #pragma once与条件编译
  • #我与Java虚拟机的故事#连载04:一本让自己没面子的书
  • $.ajax()参数及用法
  • ${ }的特别功能
  • $分析了六十多年间100万字的政府工作报告,我看到了这样的变迁
  • %check_box% in rails :coditions={:has_many , :through}
  • (2022 CVPR) Unbiased Teacher v2
  • (7)STL算法之交换赋值
  • (附源码)计算机毕业设计SSM教师教学质量评价系统
  • (力扣记录)235. 二叉搜索树的最近公共祖先
  • (六)库存超卖案例实战——使用mysql分布式锁解决“超卖”问题
  • (三)elasticsearch 源码之启动流程分析
  • (十二)python网络爬虫(理论+实战)——实战:使用BeautfulSoup解析baidu热搜新闻数据
  • (图)IntelliTrace Tools 跟踪云端程序
  • (转)EOS中账户、钱包和密钥的关系
  • (转)关于如何学好游戏3D引擎编程的一些经验
  • ./indexer: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object fil
  • .cfg\.dat\.mak(持续补充)
  • .NET MVC之AOP
  • .Net8 Blazor 尝鲜
  • .NET大文件上传知识整理
  • .NET学习教程二——.net基础定义+VS常用设置