Apache HTTP Server /etc/apache2/conf.d/default.conf

原始 📋 Alpine Linux v3.21 70 行

适用于

当前查看:
Alpine Linux v3.21
相同于:
其他版本:

详情

大小
70 行
MD5
557a5ba2f7ee33171e90190eb6ef8f88
SHA256
ef417e33de3b08faa204411fed29bb5e88d8c6945b93d50af1b0984a7129a4c0
/etc/apache2/conf.d/default.conf
#
# This configuration file reflects default settings for Apache HTTP Server.
#
# You may change these, but chances are that you may not need to.
#

#
# 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 On

#
# 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 5

#
# UseCanonicalName: Determines how Apache constructs self-referencing 
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride 
# directive.
#
AccessFileName .htaccess

#
# 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

#
# Set a timeout for how long the client may take to send the request header
# and body.
# The default for the headers is header=20-40,MinRate=500, which means wait
# for the first byte of headers for 20 seconds. If some data arrives,
# increase the timeout corresponding to a data rate of 500 bytes/s, but not
# above 40 seconds.
# The default for the request body is body=20,MinRate=500, which is the same
# but has no upper limit for the timeout.
# To disable, set to header=0 body=0
#
<IfModule reqtimeout_module>
  RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
</IfModule>

复制粘贴

curl:
curl https://exampleconfig.com/api/v1/config/original/557a5ba2f7ee33171e90190eb6ef8f88?hint=default.conf
wget:
wget -O default.conf https://exampleconfig.com/api/v1/config/original/557a5ba2f7ee33171e90190eb6ef8f88?hint=default.conf

给 AI Agent 用

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/557a5ba2f7ee33171e90190eb6ef8f88?hint=default.conf' /><config><app>Apache HTTP Server</app><os>Alpine Linux v3.21</os><location>/etc/apache2/conf.d/default.conf</location><lines>70</lines><md5>557a5ba2f7ee33171e90190eb6ef8f88</md5><sha256>ef417e33de3b08faa204411fed29bb5e88d8c6945b93d50af1b0984a7129a4c0</sha256></config></prompt>

粘贴到 Claude、ChatGPT 或任何 AI 助手里。

安装 Apache HTTP Server

Alpine Linux

sudo apk add apache2

Debian

sudo apt update && sudo apt install apache2

Red Hat Enterprise Linux

sudo yum install httpd

Ubuntu

sudo apt update && sudo apt install apache2

文件位置

文件路径
/etc/apache2/conf.d/default.conf
目录
/etc/apache2/conf.d/
用途
系统级配置目录
说明
/etc/ 里的文件是系统级配置,影响所有用户。

FAQ

什么时候该用这个 default.conf?

用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 Apache HTTP Server config 做 diff。

怎么恢复 Apache HTTP Server 的默认配置?

下载文件,把 /etc/apache2/conf.d/default.conf 里的当前配置备份好,替换掉,然后 reload 或 restart Apache HTTP Server。

default.conf 适合直接上生产吗?

这是 Alpine Linux v3.21 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。

和其他 OS 版本有什么不同?

默认值会随发行版和版本变化,这份对应 Alpine Linux v3.21。

我可以用它来排查 Apache HTTP Server 吗?

可以。和你的配置做 diff 找出漂移,然后只恢复需要的段落。