简体   繁体   English

WordPress htaccess中的服务器状态

[英]server-status in wordpress htaccess

I want to enable server-status from mod_status 我想从mod_status启用服务器状态

I have this on .htaccess file 我在.htaccess文件上有这个

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

httpd.conf is httpd.conf是

<Location /server-status>
    SetHandler server-status
    Order Allow,Deny
    Deny from all
    Allow from 111.11.1.1
</Location>

I'm using my external IP. 我正在使用我的外部IP。 I'm using this website to know my IP address. 我正在使用该网站来知道我的IP地址。 https://www.whatismyip.com/ https://www.whatismyip.com/

But when I access example.com/server-status it's a 403 forbidden but then when I change the http conf to allow from all it can be accessed but I want it to only be accessible to my computer 但是,当我访问example.com/server-status时,它是一个403禁止访问,但是当我更改http conf以允许所有内容都可以访问时,但我希望它只能由我的计算机访问

Directive Order can be tricky, maybe that's the reason why it is deprecated. 指令Order可能很棘手,也许这就是它被弃用的原因。

Nevertheless, when you want to use it, just go by the examples in the documentation 不过,当您要使用它时,只需按照文档中的示例进行操作即可

In the following example, all hosts in the example.org domain are allowed access; 在以下示例中,允许example.org域中的所有主机访问; all other hosts are denied access. 所有其他主机都被拒绝访问。

  Order Deny,Allow Deny from all Allow from example.org 

Do you see the different order of Deny,Allow ? 您看到Deny,Allow顺序不同吗?


To use the current Require directive, this should work 要使用当前的Require指令,这应该可以工作

Require ip 111.11.1.1

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

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