Директива Apache Alias ​​нарушает CGI - PullRequest
0 голосов
/ 13 мая 2019

Итак, я пытаюсь настроить Nagios на Mac mini и очень озадачен этой проблемой.Если я закомментирую директиву Alias ​​в VirtualHost, CGI будет работать нормально, но тогда все мои файлы js и css не будут найдены.С другой стороны, если я оставлю директиву Alias, мои cgi прервутся.

Вот мой vhost conf для моей установки nagios.Любая помощь будет так ценится!

<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 голосов
/ 13 мая 2019

Хорошо ... странно! Если я переместу директиву Alias ​​вниз, между закрывающим тегом virtualhost и после тега scriptalias, это решит проблему.

Я понятия не имею, почему, хотя!

...