虚拟主机中未显示的本地资源(images / js / css)

时间:2016-01-20 15:40:39

标签: apache apache2 virtualhost httpd.conf nagios

我正在使用mod_proxy_fcgi为Apache 2.4设置nagios的虚拟主机,以便将php请求发送到php-fpm。

我想知道当我转到ProxyPassMatch时,200.000.00:22222/nagios/index.php是否会使所有本地资源(包括图片,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>

1 个答案:

答案 0 :(得分:1)

您需要一个<Directory /usr/local/nagios>部分,允许Apache从该目录提供服务。基本上,对于不属于现有AliasDocumentRoot的每个require all grantedDirectory,您需要其中一个。

通常您只需要DocumentRoot's部分中的“SELECT source_id, company_id, avg_click FROM table_company TC WHERE avg_click=(SELECT max(avg_click) FROM table_company TC2 WHERE TC.company_id=TC2.company_id GROUP BY TC2.company_id); ”或“命令拒绝,允许(2.2.x及更早版本)”,但请检查现有WITH pom AS(SELECT company_id, max(avg_click) MaxAvgCl from table_company group by company_id) SELECT pom.company_id, T.avg_click, T.source_id FROM pom JOIN table_company T on T.company_id=pom.company_id and T.avg_click=pom.MaxAvgCl; < / p>