
Mir wurde gesagt, dass es eine Möglichkeit gibt, eine URL mit dem Namen zu aktivieren http://<your host>/server-status
, und dass diese Seite einige Betriebsmetriken des Apache-Dienstes anzeigen würde. Aber jedes Mal, wenn ich diese URL besuche, erhalte ich die Meldung „Seite nicht gefunden“. So habe ich es eingerichtet:
- Starten Sie eine neue virtuelle Maschine in meinem Büronetzwerk. Die lokale IP-Adresse dieser Maschine lautet
192.168.0.42
. Die Maschine verwendet Ubuntu 22.04. - Ich führe aus
apt-get update && apt dist-upgrade -y && apt-get install -y apache2
. Dadurch wird Apache 2.4.52 installiert. - Der Windows-Computer, an dem ich arbeite, hat die lokale IP-Adresse
192.168.0.16
. Auf diesem Computer tippe ichhttp://192.168.0.42
und kann die Apache-Standardwebseite sehen. - Auf der Maschine von
192.168.0.42
gebe ich eina2enmod rewrite && a2enmod status
. - Ich stelle folgende Dateien zur Verfügung
// /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
Als nächstes tippe ich systemctl restart apache2
in das Bash-Terminal der 192.168.0.42
Maschine.
Als nächstes erhalte ich eine 404-Fehlermeldung, wenn mein 192.168.0.16
Computer über den Google Chrome-Browser geladen wird http://192.168.0.42/server-status
.
Wenn ich den Befehl wget http://192.168.0.42/server-status
aus der Shell ausführe 192.168.0.42
, erhalte ich die Fehlermeldung 404.
Wenn ich den Befehl wget http://127.0.0.1/server-status
aus der Shell ausführe 192.168.0.42
, erhalte ich die Fehlermeldung 404.
Wenn ich den Befehl wget http://localhost/server-status
aus der Shell ausführe 192.168.0.42
, erhalte ich die Fehlermeldung 404.
Was mache ich falsch?