
라는 URL을 활성화하는 방법이 http://<your host>/server-status
있으며 이 페이지에는 Apache 서비스의 일부 운영 메트릭이 표시된다는 말을 들었습니다. 하지만 해당 URL을 방문할 때마다 404 페이지를 찾을 수 없다는 메시지가 나타납니다. 설정 방법은 다음과 같습니다.
- 내 사무실 네트워크에서 새 가상 머신을 시작합니다. 이 컴퓨터의 로컬 IP 주소는 입니다
192.168.0.42
. 이 머신은 Ubuntu 22.04를 사용합니다. - 난 달린다
apt-get update && apt dist-upgrade -y && apt-get install -y apache2
. 그러면 Apache 2.4.52가 설치됩니다. - 내가 작업하는 Windows 컴퓨터의 로컬 IP 주소는
192.168.0.16
. 이 컴퓨터에서 입력을 하면http://192.168.0.42
Apache 기본 웹 페이지가 표시됩니다. - 의 컴퓨터에
192.168.0.42
를 입력합니다a2enmod rewrite && a2enmod status
. - 다음 파일을 제공합니다
// /etc/apache2/apache2.conf
DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
/etc/apache2/mods-available/status.conf && /etc/apache2/mods-enabled/status.conf
<IfModule mod_status.c>
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the "192.0.2.0/24" to allow access from other hosts.
<Location /server-status>
SetHandler server-status
Require local
Require ip 192.168.0.42/24
Require ip 192.168.0.16/24
</Location>
# Keep track of extended status information for each request
ExtendedStatus On
# Determine if mod_status displays the first 63 characters of a request or
# the last 63, assuming the request itself is greater than 63 chars.
# Default: Off
#SeeRequestTail On
<IfModule mod_proxy.c>
# Show Proxy LoadBalancer status in mod_status
ProxyStatus On
</IfModule>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
다음으로 머신 systemctl restart apache2
의 bash 터미널에 입력합니다 192.168.0.42
.
다음으로 내 192.168.0.16
컴퓨터가 Google Chrome 브라우저를 통해 로드 되면 http://192.168.0.42/server-status
404가 표시됩니다.
wget http://192.168.0.42/server-status
셸에서 명령을 실행하면 192.168.0.42
404가 표시됩니다.
wget http://127.0.0.1/server-status
셸에서 명령을 실행하면 192.168.0.42
404가 표시됩니다.
wget http://localhost/server-status
셸에서 명령을 실행하면 192.168.0.42
404가 표시됩니다.
내가 도대체 뭘 잘못하고있는 겁니까?