I am quite new to Apache configuration (working with AWS).
In /etc/httpd/conf/httpd.conf
there is this directive:
IncludeOptional conf.d/*.conf
# Enable server-status for internal IP
<Location /server-status>
SetHandler server-status
Require ip 127.0.0.1
</Location>
It's working and throwing 403 error, when visiting http://example.com/server-status
Now I want to add my own IP address without actually changing this file, so I use /etc/httpd/conf.d/customRules.conf
(11.234.567.789
is actual my IP)
# Enable server-status for internal IP
<Location /server-status>
SetHandler server-status
Require ip 127.0.0.1 11.234.567.789
</Location>
But I still receive 403
error like it's not working.
How to overwrite directive from conf/httpd.conf
in conf.d/customRules.conf
?
Best Answer
Make sure that the line reading
Include conf.d/*.conf
(orIncludeOptional
) inhttpd.conf
comes after theLocation
block, otherwise your own config will be overwritten again.Yes, it might be necessary to alter
httpd.conf
in this case - you can't avoid this.