I am running node apache-exporter
(https://github.com/Lusitaniae/apache_exporter) in the same Docker container (build from httpd image) as Apache itself.
(So am able to distribute the service directly with the container by one Dockerfile and one docker-compose other like using two Dockerfiles and combine the 2 containers in one docker-compose file.)
The apache-exporter
(and the Apache server) runs and I can see the apache-up
data in Prometheus/Grafana.
I have inserted the Location
block inside my httpd.conf
<VirtualHost *:80>
ServerName XXX.XXX.XXX.XX
ServerAlias www.XXX.XXX.XXX.XX
<Location /server-status>
SetHandler server-status
#Require local
Require host example.com
#Require ip YYY.YYY.YYY.YYY
</Location>
Redirect permanent / https://XXX.XXX.XXX.XXX
</VirtualHost>
XXX.XXX.XXX.XXX
= external IP, YYY.YYY.YYY.YYY
= IP inside docker network and loaded the modules
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
But I got the error:
level=error msg="Error scraping apache: error scraping apache: Get \"https:///XXX.XXX.XXX.XXXserver-status/?auto\": dial tcp: lookup XXX.XXX.XXX.XXXserver-status on YYY.YYY.YYY.YYY: no such host" source="apache_exporter.go:571"
What is wrong? Is a /
missing somewhere? Do I have to write the Location
block inside another VirtualHost
block using another ServerName
? Do I have to set --scrape_uri
?
I guess it is just a stupid mistake by me because the /
is missing between IP and server-status
. I seems that the Location
is not considered and thus the URL is processed by Redirect permanent
. Using several ProxyPass
inside a VirtualHost
is possible when placing the /
redirection last.
I want to restrict access to server-status
to the Apache-container itself.
Redirect permanent
might help. That is, an automatic redirect toserver-status
may already be in place.Require all granted
inside the location block.