什么时候该用这个 000-default.conf?
用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 Apache HTTP Server config 做 diff。
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
curl https://exampleconfig.com/api/v1/config/original/45ed6a20d7ff26b62d873585bc1b42ca?hint=000-default.conf
wget -O 000-default.conf https://exampleconfig.com/api/v1/config/original/45ed6a20d7ff26b62d873585bc1b42ca?hint=000-default.conf
<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/45ed6a20d7ff26b62d873585bc1b42ca?hint=000-default.conf' /><config><app>Apache HTTP Server</app><os>Ubuntu 24.04 LTS (Noble Numbat)</os><location>/etc/apache2/sites-available/000-default.conf</location><lines>29</lines><md5>45ed6a20d7ff26b62d873585bc1b42ca</md5><sha256>39fe841a64538ee980ae4ef011bdf6ae7124f63bf44afd65553cf3e0618e952c</sha256></config></prompt>
粘贴到 Claude、ChatGPT 或任何 AI 助手里。
sudo apk add apache2
sudo apt update && sudo apt install apache2
sudo yum install httpd
sudo apt update && sudo apt install apache2
什么时候该用这个 000-default.conf?
用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 Apache HTTP Server config 做 diff。
怎么恢复 Apache HTTP Server 的默认配置?
下载文件,把 /etc/apache2/sites-available/000-default.conf 里的当前配置备份好,替换掉,然后 reload 或 restart Apache HTTP Server。
000-default.conf 适合直接上生产吗?
这是 Ubuntu 24.04 LTS (Noble Numbat) 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。
和其他 OS 版本有什么不同?
默认值会随发行版和版本变化,这份对应 Ubuntu 24.04 LTS (Noble Numbat)。
我可以用它来排查 Apache HTTP Server 吗?
可以。和你的配置做 diff 找出漂移,然后只恢复需要的段落。