Unable to get /server-status mod working with Apache2 on Ubuntu

I have installed the default WordPress application image from digital ocean. I tried to follow this tutorial but it doesn’t work for me:

If I visit http://<my IP>/server-status I get a 404 page the one and only website I have installed on this server. If I visit I get this:


You don't have permission to access /server-status on this server.

How can I get this working?

If I try to visit it from lynx from the local host in the terminal whether I use domain name, IP or or localhost I get 404 not found (weird!).

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

OK with a lot of trial and error I solved it.

The rewrite rule apparently cannot be above or below the WordPress stuff in the .htaccess of the root and it has to be in the middle as shown below or at least this is the only way that has worked for me so far:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# rewrite rule for server-status to prevent 404 error
RewriteCond %{REQUEST_URI} !=/server-status

RewriteRule . /index.php [L]
# END WordPress

Also, I learned that for those of us running Cloud Flare (which is a lot, including I noticed) you need to install the cloudflare mod or else limiting access by IP doesn’t work.

Perhaps Digital Ocean should consider adding mod_cloudflare to their stock WordPress one click install image and maybe others.

Thanks for the help.

You’re getting a 403 Forbidden error because Apache is configured to only allow localhost to access /server-status:

	Allow from ::1

You can allow access from your IP address like this:

<Location /server-status>
	Allow from ::1
	Allow from Your.IP.Address.Here

As for the 404 error, it looks like Wordpress is trying to serve /server-status because of the rewrite rules. There should be a few RewriteCond lines in the .htaccess, add the following line below them:

RewriteCond %{REQUEST_URI} !=/server-status

What worked for me was to turn RewriteEngine Off for the /server-status Location

<Location /server-status> SetHandler server-status Order Deny,Allow Deny from all Allow from ::1 RewriteEngine Off </Location> ExtendedStatus On

Hope it helps