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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19083383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 10:56:50  来源:igfitidea点击:

How to properly enable mod_status on an apache server?

windowsapachewebserverstatushttpd.conf

提问by Willy

I have been searching everywhere looking for how to properly enable mod_status and nothing has worked. My server is called "willserver.main.ca". I am running the server on a windows virtual machine. I tried adding this to HTTPD config file:

我一直在到处寻找如何正确启用 mod_status ,但没有任何效果。我的服务器名为“willserver.main.ca”。我在 Windows 虚拟机上运行服务器。我尝试将其添加到 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

任何提示或帮助?我不知道我是否应该取消注释,或者我只是一遍又一遍地尝试错误的语法

回答by Welsh

Ok, first confirm that you have a LoadModulethat 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.100is your internal IP if accessing internally or your external IP. This will restrict it so not just anyone can access it. You can then add multiple Allow fromfor each IP / IP range that requires access.

192.168.1.100如果访问内部或外部 IP,您的内部 IP在哪里。这将限制它,因此不是任何人都可以访问它。然后,您可以Allow from为需要访问的每个 IP/IP 范围添加多个。

回答by Nomad77

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

订单允许,拒绝

回答by Amol

mod_status built into Apache web server to get server status from a web browser. With this module we can easily find out how well the server is performing. All reports are generated in a html format.

mod_status 内置于 Apache Web 服务器中,用于从 Web 浏览器获取服务器状态。使用此模块,我们可以轻松了解服务器的性能。所有报告均以 html 格式生成。

Step1. Check if status module is enabled or not apache2ctl -M or ls /etc/apache2/sites-enabled

第1步。检查状态模块是否启用 apache2ctl -M 或 ls /etc/apache2/sites-enabled

Step2. If not enabled, enable it by the command,

第2步。如果没有启用,通过命令启用它,

sudo a2enmod status

须藤 a2enmod 状态

step3. 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

我们可以通过编辑 , Allow from our_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重启

Step5. Check the server status page in browser

第五步。在浏览器中查看服务器状态页面

http://server-ip/server-status

http://server-ip/server-status

Hope this would be helpful.

希望这会有所帮助。

回答by Vlax

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/

回答by Bernardo Silva

I developed a javascript application to display data in graphs https://github.com/dioubernardo/apacheServerStatusCharts

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

回答by Gabriele F.