# [SOLVED] Getting Apache server-status working with vhosts...

## krovisser

I've been trying for some time to get my apache server-status module to work.

I have http.conf set for vhost support. The status modules is loading. I have tried putting the status handler in 00_default_vhost.conf and httpd.conf without luck. I read somewhere on the web that you can't use server status inside any virtual host. So far this seems correct.

Also according to what I read (http://www.mydigitallife.info/2007/04/23/request-url-server-status-or-404-page-not-found-apache-error/), you can try putting an additional "Listen 8080" to change the port. He doesn't mention which config file to put this in... But I think I tried them all and it didn't work.

Also, his other option is to change the "NameVirtualHost *:80" to "NameVirtualHost 127.0.0.1:80" to get it to work. Doesn't work either.

I've been trying this from ssh in and using links, and also using other computers on the network. I have included "Allow from 192.168.1.*" and others to allow this access.

The furthest I have gotten is from 404 pages to 403 - forbidden. What gives?

----------

## AllenJB

Firstly note that if apache is listening on 127.0.0.1, you'll only be able to view pages on the same machine. 127.0.0.1 (AKA localhost) is the "local loopback" used when a computer wants to talk only to itself.

Additionally, to find the root cause of the problem you're going to need to give us more information. Your first port of call should be the log files, which can usually be found in /var/log/apache2. Apache also provides a means for testing its configuration files for obvious errors - you can do this by running "apache2 -t" (see "man apache2" for more details).

If you're still stuck, we're also going to need to see the virtual hosts section of your main configuration file (httpd.conf) and the configuration for each of your virtual hosts (particularly the one with the serverstatus section). Also, do the virtualhosts work before you try adding the serverstatus section? Do they continue to work afterwards (other than not being able to access the serverstatus page)?

----------

## krovisser

Sorry, my post wasn't really helpful. I'm aware of what the local loopback is and does. From what I read, you cannot put the server status handler inside any "publically available" virtual host, whatever that means.

I have just the default virtual host. I have tried putting the status handler in the main httpd.conf, with no luck. I tried putting it in 00_default_vhost.conf with no luck. I also tried a combination of the previous things along with adding Listen 8080 to it, with no luck. 

The furthest I have gotten is a 403 page, using a few of the ways above (ie, 'xyz:8080/server-status', 'xyz:80/server-status').

The vhost I have works fine: http://black.selfunaware.com/, either with the server-status part enabled or not.

The log files don't tell me anything new, either 404 errors or access forbidden errors.

Here's my http.conf:

```
black ~ # cat /etc/apache2/httpd.conf

# SNIPPED

<IfDefine STATUS>

LoadModule status_module modules/mod_status.so

</IfDefine>

# SNIPPED

#LoadModule vhost_alias_module modules/mod_vhost_alias.so

User apache

Group apache

Include /etc/apache2/modules.d/*.conf

Include /etc/apache2/vhosts.d/*.conf

#Listen 8080

#<Location /server-status>

#       SetHandler server-status

#       Order Deny,Allow

#       Deny from all

#       Allow from localhost

#        Allow from 127.0.0.1

#        Allow from 192.168.1.*

#</Location>

ServerName black.selfunaware.com

```

My default vhost file:

```

black ~ # cat /etc/apache2/vhosts.d/00_default_vhost.conf

<IfDefine DEFAULT_VHOST>

Listen 80

NameVirtualHost *:80

<VirtualHost *:80>

        ServerName black.selfunaware.com

        Include /etc/apache2/vhosts.d/default_vhost.include

        <IfModule mpm_peruser_module>

                ServerEnvironment apache apache

        </IfModule>

# Redirects all http -> https

#       RewriteEngine On

#       RewriteCond %{HTTPS} !on

#        RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

</VirtualHost>

</IfDefine>

```

My mod_status.conf:

```
black ~ # cat /etc/apache2/modules.d/00_mod_status.conf

<IfDefine STATUS>

<IfModule status_module>

<Location /server-status>

        SetHandler server-status

        Order deny,allow

        Deny from all

        Allow from 127.0.0.1

        Allow from 192.168.1.0/255

</Location>

ExtendedStatus On

</IfModule>

</IfDefine>

```

----------

## krovisser

Anyone?

----------

## elgato319

1. enable mod_status in /etc/conf.d/apache2 "-D STATUS"

2. edit /etc/apache2/modules.d/00_mod_status.conf

comment

 *Quote:*   

> Deny from all
> 
>         Allow from 127.0.0.1

 

add

 *Quote:*   

> 
> 
> Allow from all
> 
> 

 

3. leave all other config files untouched

4. restart apache2

try to access http://black.selfunaware.com/server-status

CAUTION! server-status can than be accessed by everyone!

----------

## krovisser

I did the above, except I change the mod_status.conf to read:

```
<Location /server-status>

        SetHandler server-status

        Order deny,allow

        Deny from all

        Allow from localhost

        Allow from 127.0.0.1

        Allow from 192.168.1.*

        Allow from 192.168.1.0\255

</Location>

```

And again, MOD_STATUS is enabled in http.conf. I now also have unmodified default_vhost and other config files.

I can acccess the status page from localhost, finally. Thank you! I have no idea where I screwed up, but I still cannot access it from my LAN (192.168.1.*), using the any combination of the above 192.168.xyz lines. It says 403 forbidden.

----------

