VirtualHost 中的位置指令

Yeh*_*lam 2 apache-2.2

我正在尝试在我的虚拟主机之一下添加服务器状态位置指令,但是在浏览到 www.mywebsite.com/server-status 时,我收到了 403 Access Forbidden。将位置指令置于虚拟主机下是否合法?

编辑 #1:完整的虚拟主机配置

<VirtualHost *:80>
  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin yehiasalam@cairocubicles.com
  ServerName  aumento.io
  ServerAlias  www.aumento.io


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/cairocubicles/web/aumento.io/public
    <Directory /home/cairocubicles/web/aumento.io/public>
        Order Allow,Deny
        Allow from all
        Options Indexes FollowSymLinks
        AllowOverride All
        AcceptPathInfo On
    </Directory>

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

  # Custom log file locations
  LogLevel warn
  ErrorLog  /home/cairocubicles/web/aumento.io/log/error.log

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

use*_*517 5

是的,文档指出位置可以在服务器和虚拟主机上下文中使用。

检查底层文件系统以确保网络服务器具有访问文件和目录的合适权限。


您的更新显示您只允许从 aumento.io 访问。确保 aumento.io 的 IP 地址解析为您正在连接的机器的地址。如果确实如此,并且网络服务器与 aumento.io 位于同一台机器上,那么您应该检查日志以查看 apache 认为您正在连接的 IP 地址并将其添加到列表中(您很可能是通过环回接口连接)例如

Allow From aumento.io 127.0.0.1
Run Code Online (Sandbox Code Playgroud)