Apache 403 Error – Resolving server-status 403 on Non-Standard Port

apache-2.2

We have an Apache server configured such that in conf/httpd.conf we have (the rest of the file has been removed for brevity):

LoadModule status_module modules/mod_status.so
ExtendedStatus On

And in conf.d/myserver.conf we have (other bits removed again):

Listen 8162
<VirtualHost *:8162>

<Location /server-status>
    SetHandler server-status
    Order allow,deny
    Allow from localhost
    Deny from all
</Location>

</VirtualHost>

Note that in httpd.conf, all Listen directives are commented out, meaning that Apache is only listening on port 8162. <Location /server-status> is also commented out in httpd.conf.

We get a 403 when we try:

wget http://localhost:8162/server-status

Can server-status run on a non-standard port? If it can, what else should we be looking for in order to make server-status accessible from the localhost?

Best Answer

this worked for me, when using varnish on port 80, serving apache from port 8000 with an additional apache Listen on port 8001 defined in

/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 ".example.com" to allow
# access from other hosts.
#

Listen 8001
ExtendedStatus On
<VirtualHost *:8001>
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from localhost ip6-localhost 
    #    Allow from .example.com
    </Location>
</VirtualHost>
</IfModule>

you can test it with lynx

lynx -dump http://127.0.0.1:8001/server-status

the lynx output should look like something like this: ~

                       Apache Server Status for 127.0.0.1

   Server Version: Apache/2.2.14 (Ubuntu) mod_ssl/2.2.14 OpenSSL/0.9.8k
   Server Built: Nov 3 2011 03:29:23
     __________________________________________________________________

   Current Time: Saturday, 03-Dec-2011 12:36:05 CET
   Restart Time: Friday, 02-Dec-2011 00:59:04 CET
   Parent Server Generation: 22
   Server uptime: 1 day 11 hours 37 minutes
   Total accesses: 44550 - Total Traffic: 368.1 MB
   CPU Usage: u27.53 s3.48 cu0 cs0 - .0242% CPU load
   .347 requests/sec - 3010 B/second - 8.5 kB/request
   2 requests currently being processed, 4 idle workers

W___._W.........................................................

--cut--