Apache Alias指令破坏了CGI

时间:2019-05-13 18:43:34

标签: javascript css alias nagios

因此,我试图在Mac mini上安装Nagios,但对此问题感到非常困惑。如果我在VirtualHost中注释掉Alias指令,则CGI可以正常工作,但是找不到我的所有js和css文件。 另一方面,如果我保留Alias指令,我的cgi将中断。

这是我的nagios设置的vhost conf。任何帮助将不胜感激!

<VirtualHost *:80>
  ServerName nagios.mydomain.local
  DocumentRoot "/usr/local/Cellar/nagios/4.4.3/share/nagios/htdocs"
  #Alias /nagios "/usr/local/Cellar/nagios/4.4.3/share/nagios/htdocs"

  <Directory "/usr/local/Cellar/nagios/4.4.3/sbin">
    Options ExecCGI
    AllowOverride None

    <IfModule dir_module>
      AddHandler cgi-script .cgi
    </IfModule>

    <IfVersion >= 2.3>
      <RequireAll>
        Require all granted
        AuthName "Nagios Access"
        AuthType Basic
        AuthUserFile /usr/local/etc/nagios/htpasswd.users
        Require valid-user
      </RequireAll>
    </IfVersion>
    <IfVersion < 2.3>
      Order allow,deny
      Allow from all
      AuthName "Nagios Access"
      AuthType Basic
      AuthUserFile /usr/local/etc/nagios/htpasswd.users
      Require valid-user
    </IfVersion>
  </Directory>

  <Directory "/usr/local/Cellar/nagios/4.4.3/share/nagios/htdocs">
  #  SSLRequireSSL
    Options None
    AllowOverride None

    <IfModule dir_module>
      DirectoryIndex index.php index.html index.htm
      AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps
    </IfModule>

    <IfVersion >= 2.3>
      <RequireAll>
        Require all granted
        AuthName "Nagios Access"
        AuthType Basic
        AuthUserFile /usr/local/etc/nagios/htpasswd.users
        Require valid-user
      </RequireAll>
    </IfVersion>
    <IfVersion < 2.3>
      Order allow,deny
      Allow from all
      AuthName "Nagios Access"
      AuthType Basic
      AuthUserFile /usr/local/etc/nagios/htpasswd.users
      Require valid-user
    </IfVersion>
  </Directory>

  ErrorLog "/var/log/apache2/nagios.mydomain.local-error_log"
  CustomLog "/var/log/apache2/nagios.mydomain.local-access_log" common

  ScriptAlias /nagios/cgi-bin "/usr/local/Cellar/nagios/4.4.3/sbin"
</VirtualHost>

1 个答案:

答案 0 :(得分:0)

好吧...很奇怪!如果我将Alias指令移到底部,在关闭的virtualhost标记和scriptalias标记之间,则可以解决此问题。

我不知道为什么!