简体   繁体   English

如何在apache服务器上正确启用mod_status?

[英]How to properly enable mod_status on an apache server?

I have been searching everywhere looking for how to properly enable mod_status and nothing has worked. 我一直在寻找如何正确启用mod_status并且没有任何工作。 My server is called "willserver.main.ca". 我的服务器名为“willserver.main.ca”。 I am running the server on a windows virtual machine. 我在Windows虚拟机上运行服务器。 I tried adding this to HTTPD config file: 我尝试将其添加到HTTPD配置文件中:

<location /server-status>
SetHandler server-status

Order Deny,Allow
Deny from all
Allow from main.ca

</location>

Any tips or help? 任何提示或帮助? I don't know if I am supposed to uncomment something or if I am just trying the wrong syntax over and over 我不知道我是否应该取消注释,或者我只是一遍又一遍地尝试错误的语法

Ok, first confirm that you have a LoadModule that looks similar to this: 好的,首先确认你有一个类似于这个的LoadModule

LoadModule status_module modules/mod_status.so

If that isn't there, then you'll need to download and add it. 如果不存在,那么您需要下载并添加它。

If it is there then try this: 如果它在那里然后试试这个:

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

See if you can then hit http://www.my-domain.com/server-status 看看你是否可以访问http://www.my-domain.com/server-status

If you can then switch it to: 如果你可以把它切换到:

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

Where 192.168.1.100 is your internal IP if accessing internally or your external IP. 如果内部访问或您的外部IP,则192.168.1.100是您的内部IP。 This will restrict it so not just anyone can access it. 这将限制它,因此不只是任何人都可以访问它。 You can then add multiple Allow from for each IP / IP range that requires access. 然后,您可以为需要访问的每个IP / IP范围添加多个Allow from

Apache 2.4 do not appear to like a space in the Order directive. Apache 2.4似乎不喜欢Order指令中的空格。

Order Allow, Deny only works as 订单允许,拒绝仅适用于

Order Allow,Deny 订单允许,拒绝

mod_status built into Apache web server to get server status from a web browser. mod_status内置到Apache Web服务器中以从Web浏览器获取服务器状态。 With this module we can easily find out how well the server is performing. 使用此模块,我们可以轻松了解服务器的性能。 All reports are generated in a html format. 所有报告都以html格式生成。

Step1. 第1步。 Check if status module is enabled or not apache2ctl -M or ls /etc/apache2/sites-enabled 检查状态模块是否已启用apache2ctl -M或ls / etc / apache2 / sites-enabled

Step2. 第2步。 If not enabled, enable it by the command, 如果未启用,请通过命令启用它,

sudo a2enmod status sudo a2enmod状态

step3. 第3步。 Configure access, 配置访问权限

Open /etc/apache2/mods-enabled/status.conf and comment the lines, 打开/etc/apache2/mods-enabled/status.conf并注释这些行,

        #<Location /server-status>
        #    SetHandler server-status
        #    Require local
        #Require ip 192.0.2.0/24
        #</Location>

And add the following line, 并添加以下行,

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

We can restrict the access of server status for particular IP's in this configuration by editing , Allow from our_public_ipaddress instead of Allow from all 我们可以通过编辑,允许from_public_ipaddress而不是Allow from all来限制此配置中特定IP的服务器状态访问

Save the status.conf file . 保存status.conf文件。

Step4. 第四步。 Restart apache by the command, 通过命令重启apache,

/etc/init.d/apache2 restart /etc/init.d/apache2 restart

Step5. 第五步。 Check the server status page in browser 在浏览器中检查服务器状态页面

http://server-ip/server-status HTTP://服务器IP /服务器状态

Hope this would be helpful. 希望这会有所帮助。

In Mac OS X Yosemite I had to use this otherwise some endless loop was happening: 在Mac OS X Yosemite中我不得不使用它,否则会发生一些无限循环:

<IfModule mod_status.c>
   # Allow server status reports generated by mod_status,
   # with the URL of http://servername/server-status
   # Change the ".example.com" to match your domain to enable.
   #
   <Location /server-status>
     SetHandler server-status
     Order deny,allow
     Allow from all
   </Location>
</IfModule>

Taken from https://osiutino.wordpress.com/2014/06/12/install-apache-2-4-9-on-mac-osx-10-9-mavericks/ 取自https://osiutino.wordpress.com/2014/06/12/install-apache-2-4-9-on-mac-osx-10-9-mavericks/

我开发了一个javascript应用程序来显示图表中的数据https://github.com/dioubernardo/apacheServerStatusCharts

您可以在下面找到一个有用的链接: http//www.tecmint.com/monitor-apache-web-server-load-and-page-statistics/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM