【问题标题】:Local resources (images/js/css) not showing in Virtual Host本地资源(图像/js/css)未显示在虚拟主机中
【发布时间】:2016-04-26 13:13:34
【问题描述】:

我正在使用 Apache 2.4 为 nagios 设置一个虚拟主机,使用 mod_proxy_fcgi 将 php 请求转发到 php-fpm。

我想知道当我转到200.000.00:22222/nagios/index.php 时,是否是ProxyPassMatch 导致所有本地资源(包括图像、js、css)都无法加载。

所有资源都被解释为Content-Type:text/html; charset=iso-8859-1,如响应标头中所示。它们显示403 Forbidden error,并在错误日志中显示AH01630: client denied by server configuration

/etc/httpd/conf.d/nagio.conf:

Listen 22222

<VirtualHost *:22222>

    ServerName {IP}:22222

    AddType image/jpeg jpeg jpg jpe

    ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

    DocumentRoot "/usr/local/nagios"

    <Directory "/usr/local/nagios/sbin">

      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

      AllowOverride None

      Require all granted

    </Directory>

    <LocationMatch "/nagios/((.*\.php)(/.*)?)$">

       ProxyPassMatch "fcgi://localhost:9000/usr/local/nagios/share/$1"

    </LocationMatch>

    <Directory "/usr/local/nagios/share">

         Options None

         AllowOverride None

         Require all granted

    </Directory>

</VirtualHost>

【问题讨论】:

    标签: apache apache2 virtualhost httpd.conf nagios


    【解决方案1】:

    您需要一个允许 Apache 从该目录提供服务的 &lt;Directory /usr/local/nagios&gt; 部分。基本上,对于每个不在现有 AliasDocumentRoot 下的 Alias,您都需要其中一个。

    通常您只需要在Directory 部分中添加“require all granted”或“order deny,allow(2.2.x 及更早版本)——但请检查您现有的DocumentRoot's

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-09
      • 1970-01-01
      • 2011-08-03
      • 2018-06-26
      • 2019-12-05
      • 1970-01-01
      • 2013-03-16
      相关资源
      最近更新 更多