Applicable to:
- Plesk for Linux
Question
How to enable the Apache server statistics on a Plesk server?
Answer
-
Connect to the Plesk server via SSH.
-
Check if "status_module" is loaded:
-
for CentOS/RHEL-based distributions:
# httpd -M | grep status
status_module (shared) -
for Debian/Ubuntu-based distributions:
# apache2ctl -M | grep status
status_module (shared)If the output is empty, enable the "status" module in Plesk at Tools & Settings > Apache Web Server.
-
-
Find out Apache version:
-
for CentOS/RHEL-based distributions:
# httpd -v | grep version
-
for Debian/Ubuntu-based distributions:
# apache2 -v | grep version
-
-
To make status reports visible to your IP address (from which you access this page in a browser), add the below code to the Apache configuration file (create a new file, if there is no):
-
CentOS/RHEL-based distributions:
CentOS 7:
/etc/httpd/conf.modules.d/status.conf
CentOS 6:/etc/httpd/conf.d/status.conf
-
Debian/Ubuntu-based distributions:
/etc/apache2/mods-enabled/status.conf
In this example, we are allowing status reports to IP addresses 203.0.113.2 and 203.0.113.3:
-
for Apache 2.2:
CONFIG_TEXT: <IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 203.0.113.2 203.0.113.3
</Location>
ExtendedStatus On
</IfModule> -
for Apache 2.4:
CONFIG_TEXT: <IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
<RequireAny>
Require ip 203.0.113.2 203.0.113.3
</RequireAny>
</Location>
ExtendedStatus On
</IfModule>
-
-
-
Restart Apache web-server:
-
for CentOS/RHEL-based distributions:
# service httpd restart
-
for Debian/Ubuntu-based distributions:
# service apache2 restart
Server statistics will now be available at http://your.server.ip.address/server-status
Warning: Apache server statistics page can contain sensitive information. For security reasons, we recommend to enable authentication/authorization (e.g. HTTP basic authentication) for this URL.
-
Comments
14 comments
CentOS 7:
/etc/httpd/conf.modules.d/status.conf
file not exists on CentOS 7.5.1804I have result "status_module (shared)" and apache 2.4.6 (CentOS)
Hi @Karl,
As written at the step 4, create etc/httpd/conf.modules.d/status.conf in case the file does not exist.
That is ok for a default installation.
Tried this and it doesn't work. Also tried putting require all granted in case I put the wrong IP but still doesn't work.
Hi @Sharul Hafiz,
It's quite tricky to conclude here what can cause this, so to sort it out, please contact support: How to submit a request to Plesk support?
I use CentOS 7.6 with Apache 2.4. The above instructions to create "/etc/httpd/conf.modules.d/status.conf" do not work.
I noticed that there is a "status.conf" already existing in "/etc/httpd/conf.d" with the following contents:
ExtendedStatus on
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
If I add another "Allow from x.x.x.x" line, where "x.x.x.x" is my IP address, it works.
Given this information, please review and advise of preferred method to enable server-status on CentOS 7.6 with Apache 2.4.
Thanks!
Update:
I settled on the following configuration, in /etc/httpd/conf.d/status.conf, which allow access by IP, or password:
ExtendedStatus on
<Location /server-status>
SetHandler server-status
AuthType basic
AuthName "Apache status"
AuthUserFile /etc/httpd/conf/server-status_htpasswd
<RequireAny>
Require valid-user
Require ip x.x.x.x
Require ip 127.0.0.1
</RequireAny>
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# Allow from x.x.x.x
</Location>
Please advise if there is a better way to do this.
@Bob B
Thank you for the feedback.
I created fresh VM with CentOS 7.6 base installation, Apache 2.4 and Plesk Onyx:
# plesk version | grep Product.
Product version: Plesk Onyx 17.8.11 Update #48
# httpd -v | grep version
Server version: Apache/2.4.6 (CentOS)
# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
And I could not see "status.conf" file in "/etc/httpd/conf.d" directory. I believe that file on your server has been created manually earlier. And our guide is compatible for CentOS 7.6 and Apache 2.4.
As for your configuration, it is fully correct. hope that other pleskians will also find your snippets useful.
@Konstantin, Thanks! This is a fresh and new server. Perhaps my dedicated server provider made customizations. Alternatively, maybe enabling Plesk's Health Monitor or Watchdog or some other extension, could have added that file.
@Bob B,
I also suppose that server provider could make some customizations in server's template. Moreover, I have installed all the components in Plesk installer, however config file still does not exist in conf.d.
With Plesk 17.8.11 update 67 on CentOS Linux release 7.6.1810 (Core) with Apache/2.4.6 (CentOS) the Apache-Status site will not work when the status.conf file is placed in the "
/etc/httpd/conf.modules.d/status.conf
" directory.I have to put the status.conf file in the "
/etc/httpd/conf.d/status.conf
" directory to get it worked.Hello @Thomas Seifert,
Thank you for your input.
I tried to reproduce the issue on my side, however, it works as expected with /etc/httpd/conf.modules.d/status.conf.
To investigate the cause of such behavior, please contact Plesk Technical Support: How to submit a request to Plesk support?
For me - I followed the steps using Ubuntu and Apache 2.4; however, when I tried to access the page, I was re-routed to the default 404 page of my default wordpress website.
I was able to get around this by turning off a default website on the IP Address (Tools > IP Address).
I had NOT set the default web site for the default IP of the system, and the server-status returned 404.
After I set the default site for the default IP of the server, THEN it started working right away. Perhaps the guide could include something about setting the default site first.
Problem is that Apache runs at port 7080 not on 80.
SSH into the server and run
or
Credits to this blog. https://blog.php-function.de/plesk-apache-mod_status-server-status-von-localhost-mit-wird-abgelehnt-unable-to-connect-to-remote-host/
thanks, Ben Da that got me on the right track. With nginx installed I had to edit /etc/apache2/envars and add the line
APACHE_STATUSURL="http://localhost:7080/server-status"
in order to be able to run `apache2ctl fullstatus`
Please sign in to leave a comment.