Apache 2.4,第二次登录

Apache 2.4,第二次登录

当我浏览我的 Apache 网站时,我会看到正常的网站登录屏幕。登录后,我可以像平常一样查看网站。但是当我单击某个超链接时,会出现一个新的登录窗口。

我可以使用相同的登录信息,它就可以正常工作。或者我可以取消第二次登录并查看完整的网站内容。但我不明白为什么系统需要第二次登录。

这是 conf-enabled/nagios.conf

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

   <Directory "/usr/local/nagios/sbin">
   #  SSLRequireSSL
   Options ExecCGI FollowSymLinks
   AllowOverride None
   #  Order allow,deny
#  Allow from all
   Order deny,allow
   #Deny from all
   Allow from 127.0.0.1 192.168.0.0/24
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user
</Directory>

    Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
#  SSLRequireSSL
   Options None FollowSymLinks
   AllowOverride None
#  Order allow,deny
   Allow from all
   Order deny,allow
   #Deny from all
   Allow from 127.0.0.1 192.168.0.0/24
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user
</Directory>

这是 conf-enabled/thruk.conf

<IfModule mod_fcgid.c>
  AddHandler fcgid-script .sh
  IPCCommTimeout 120

  <Directory /usr/share/thruk>
    Options FollowSymLinks
    AllowOverride All
    order allow,deny
    allow from all
    # required for apache 2.4
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
  </Directory>
  <Directory /etc/thruk/themes>
    Options FollowSymLinks
    allow from all
    # required for apache 2.4
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
  </Directory>
  <Directory /etc/thruk/plugins>
    Options FollowSymLinks
    allow from all
    # required for apache 2.4
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
  </Directory>

  Alias /thruk/documentation.html /usr/share/thruk/root/thruk/documentation.html
  Alias /thruk/startup.html /usr/share/thruk/root/thruk/startup.html
  AliasMatch ^/thruk/(.*\.cgi|.*\.html)  /usr/share/thruk/fcgid_env.sh/thruk/$1
  AliasMatch ^/thruk/plugins/(.*?)/(.*)$  /etc/thruk/plugins/plugins-enabled/$1/root/$2
  Alias /thruk/themes/  /etc/thruk/themes/themes-enabled/
  Alias /thruk /usr/share/thruk/root/thruk

  <Location /thruk/>
    Options ExecCGI FollowSymLinks
    AuthName "Thruk Monitoring"
    AuthName "Nagios Access"
    AuthType Basic
    #AuthUserFile /usr/local/nagios/etc/htpasswd.users
    AuthUserFile /etc/thruk/htpasswd
    Require valid-user
  </Location>
  <Location /thruk/cgi-bin/remote.cgi>
    Order Deny,Allow
    Allow from all
    Satisfy any
  </Location>
</IfModule>

# use compressed output if available
<IfModule mod_deflate.c>
  <Location /thruk/>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
  </Location>
</IfModule>

两者都使用相同的密码文件和相同的“AuthName”。由于这是某个 cgi 模块站点,我不确定问题是什么。

答案1

答案就在这里:

 AuthUserFile /usr/local/nagios/etc/htpasswd.users

当您登录应用程序时,它是第一个日志。当您尝试打开配置为使用 htpasswd 的本地文件时,它是第二个日志。禁用 htpasswd 日志以摆脱第二个日志。

只需删除这些文件:

  AuthName "Nagios Access"
  AuthType Basic
  AuthUserFile /usr/local/nagios/etc/htpasswd.users
  Require valid-user

相关内容