Wordpress, apache server status collectd and mod_rewrite
WordPress, apache server status collectd and mod_rewrite

WordPress, apache server status collectd and mod_rewrite

If you have configured the apache server-status on your WordPress, you will have, probably like me, troubles to make it work. The problem is related on the mod_rewrite configuration.

First, your server-status should look like this in your apache configuration :

<Location "/your-custom-server-status-path">
	SetHandler server-status
	Order deny,allow
	Deny from all
	Allow from localhost
	Allow from 1.2.3.4
	Allow from 10.11.13.14
</Location>

If you want to use collectd, the configuration should look like this ( /etc/collectd/collectd.conf ):

LoadPlugin apache
<Plugin apache>
        <Instance "www">
                URL "https://yourserver.domain.local/your-custom-server-status-path?auto"
        </Instance>
</Plugin>

The last step is to configure the mod_rewrite of your wordpress. Edit the file .htaccess at the root of your wordpress install :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !=/your-custom-server-status-path
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

<>

My Powershell script categories


Reference

Source

mod_rewrite apache2

mod_rewrite provides a way to modify incoming URL requests, dynamically, based on regular expression rules. This allows you to map arbitrary URLs onto your internal URL structure in any way you like.

It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule to provide a really flexible and powerful URL manipulation mechanism. The URL manipulations can depend on various tests: server variables, environment variables, HTTP headers, time stamps, external database lookups, and various other external programs or handlers, can be used to achieve granular URL matching.

Rewrite rules can operate on the full URLs, including the path-info and query string portions, and may be used in per-server context (httpd.conf), per-virtualhost context (<VirtualHost> blocks), or per-directory context (.htaccess files and <Directory>blocks). The rewritten result can lead to further rules, internal sub-processing, external request redirection, or proxy passthrough, depending on what flags you attach to the rules.

Since mod_rewrite is so powerful, it can indeed be rather complex. This document supplements the reference documentation, and attempts to allay some of that complexity, and provide highly annotated examples of common scenarios that you may handle with mod_rewrite. But we also attempt to show you when you should not use mod_rewrite, and use other standard Apache features instead, thus avoiding this unnecessary complexity.

WordPress, apache server status collectd and mod_rewrite

Leave a Reply

Your email address will not be published. Required fields are marked *