【问题标题】:laravel and apache mod_statuslaravel 和 apache mod_status
【发布时间】:2018-12-16 14:17:19
【问题描述】:

我已经在我的服务器上启用了 Apache mod_status:

OS: centos 6
Server version: Apache/2.2.15 (Unix)
php version 7.1

我收到 example.com/server-status 的 404 错误页面,因为我不知道如何使用 laravel(5.2) 路由 api 或任何其他方式为这条路线提供服务?
我在 httpd.conf 中的配置:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 ::1
    Allow from .example.com
    Allow from xxx.xxx.xxx.xxx #my ip address
</Location>

在 .htaccess 中

RewriteCond %{REQUEST_URI} !=/server-status

【问题讨论】:

  • 看来你需要修改public目录上的url重写。你的 404 给了 laravel 404 对吗?
  • 显然,您需要删除RewriteCond %{REQUEST_URI} !=/server-status 上的=。并将其放在line 20 之前。见example
  • @BagusTesa 非常感谢,您使用提供的 htaccess 测试工具拯救了我的一天。您可以将其发布为答案,我会接受它
  • 欢迎您。很高兴能帮上忙~

标签: php laravel apache laravel-5.2


【解决方案1】:

试着把它放在 virtualhost 标签内

<VirtualHost *:80>
ServerAdmin tecmint@example.com
DocumentRoot /var/www/html/example.com
ServerName example.com
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
<Location /server-status>
SetHandler server-status
Order allow,deny
Deny from all
Allow from example.com 
</Location>
</VirtualHost>

【讨论】:

    【解决方案2】:

    我在我的 .htaccess 中使用以下代码访问服务器信息和服务器状态:

    RewriteRule ^(server-info|server-status) - [L]
    

    首先确保您的服务器信息和服务器状态正常工作。 他们,阅读有关权限问题的日志(主要是因为规则的顺序)。

    我的系统:

    • Laravel 6
    • Apache 2.4.1
    • FreeBSD 12.1

    【讨论】:

      猜你喜欢
      • 2013-10-05
      • 1970-01-01
      • 1970-01-01
      • 2017-06-10
      • 2013-07-14
      • 1970-01-01
      • 2017-01-20
      • 2015-07-06
      • 1970-01-01
      相关资源
      最近更新 更多