5

I'm trying to get Munin's various Apachie plugins to work on my web server, but I'm hitting issues. Upon asking Munin to check available plugins, two of the three Apache plugins return an error saying that

apache server-status cannot be found

I've got mod_status turned on etc, and as far as I know, everything's set up correctly.

I've tried opening localhost/server-status using Lynx, at which point I get a 404 error and my Wordpress error page is shown (the one you get when you try to access a page that doesn't exist.)

Now presumably this is something to do with how I have Apache serving a Wordpress install etc. The web site lives in /var/www/wordpress, with the index.php file one level up and the .htaccess file amended as per the Wordpress instructions. It works fine, but I've a niggling feeling that when Munin/Lynx tries to load localhost/server-status, it's looking for it in /var/www/.

So, how do I tell Apache where to actually look when requesting server-status?


Here's my httpd.conf file.

ServerName localhost



<VirtualHost *:80>
ServerName oliverhaslam.com
ServerAlias oliverhaslam.com
DocumentRoot /var/www/wordpress/
</VirtualHost>


<VirtualHost *:80>
ServerName ojhaslam.co.uk
ServerAlias ojhaslam.co.uk
DocumentRoot /var/sites/photo365/
</VirtualHost>

<VirtualHost *:80>
ServerName www.ojhaslam.co.uk
ServerAlias www.ojhaslam.co.uk
RedirectMatch permanent /(.*) http://ojhaslam.co.uk/$1
DocumentRoot /var/sites/photo365/
</VirtualHost>

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

If I remove the last part, I get a 'forbidden' error instead of the error outlined above.


Appears the issue is my .htaccess file. Removing that means the server-status works, but obviously Wordpress links don't. Here's the file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#Next two don't fix the issue.    
#RewriteCond %{REQUEST_URI} !=/server-status
#RewriteRule ^(server-info|server-status) - [L]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
  • What are the relevant sections of Apache's configs for your WordPress site, and enabling mod_status? – becomingwisest Jan 15 '13 at 4:38
  • Added to original post. – Oliver Haslam Jan 15 '13 at 17:05
11

Wordpress's .htaccess file sends all non-existing files and directories to be processed by Wordpress. Try excluding the server status urls too.

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/server-status
RewriteRule . /index.php [L]
  • Thanks. This didn't actually fix the issue, as you can see in my edit above, but it will work for some. I had to use the other excluded line from above but leave this one hashed out to make it work. My problem was having them both de-commented together. – Oliver Haslam Jan 16 '13 at 11:52
1

Since I got helped with this post and in case you also failed to apply becomingwisest's answer, like I did initially, you should exactly put the condition

RewriteCond %{REQUEST_URI} !=/server-status

before rewrite rule.

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !=/server-status

RewriteRule . /index.php [L]

That's why Oliver Haslam still have the same trouble, because he put the

RewriteCond %{REQUEST_URI} !=/server-status

above other condition.

Hope this can help another people came here :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.