我遇到了一个以前从未遇到过的奇怪问题。我刚安装了 Linux(这是一个鲜为人知的基于 Ubuntu 的 linux 版本,用于一个狭窄的行业领域,我希望它本身没有太大关系)。我安装了 Apache。每次我试图打开
http://localhost
(本地)我收到 401 Authorization required 响应。
我的/etc/apache2/sites-enabled/000-default 是:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
/var/www 目录不包含任何 .htaccess 文件。/etc/apache2/apache2.conf 配置文件不包含任何包含文本“auth”的内容。
/var/www 的文件权限是:drwxrwxrwx,root:www(所有者用户 - root,组 www)。 apache 用户“www-data”是组“www”的成员。索引文件/var/www/index.html 具有相同的权限。
/etc/apache2/mods-enabled/的内容如下:
alias.conf authz_user.load dir.load php5.load
alias.load autoindex.conf env.load setenvif.conf
auth_basic.load autoindex.load mime.conf setenvif.load
authn_file.load cgi.load mime.load status.conf
authz_default.load deflate.conf negotiation.conf status.load
authz_groupfile.load deflate.load negotiation.load
authz_host.load dir.conf php5.conf
内置模块(/usr/sbin/apache2 -l):
core.c
mod_authn_pam.c
mod_auth_basic.c
mod_log_config.c
mod_logio.c
prefork.c
http_core.c
mod_so.c
有趣的是,如果我添加以下行:
Satisfy Any
到/etc/apache2/sites-enabled/000-default 文件中的
[Mon Oct 01 12:34:59 2012] [notice] child pid 4445 exit signal Segmentation fault (11)
Apache 什么都不返回,只是关闭连接。
我彻底懵了,Apache为什么要请求授权,甚至不知道怎么调试。为日志文件启用调试级别不会在 access.log 和 error.log 中显示任何内容。任何帮助或方向将不胜感激。谢谢。
最佳答案
最后我联系了这家 Linux 供应商,结果发现这个特定的 Linux 版本是以这种方式构建的,Apache 授权无法关闭,所以除了删除 apache 包之外没有任何方法可以关闭它并用其他的替换它们。
关于linux - Apache 一直要求 401 授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12669957/