直到最近,一个内部的 Bugzilla 安装运行良好。现在,对目录内页面的所有请求都http://example.com/bugzilla
返回403/Forbidden
. 该目录之外的页面,例如在http://example.com/test.html
或http://example.com/test/index.html
按预期工作。这是目录的.htaccess
文件,bugzilla
与原始文件没有变化:
# Don't allow people to retrieve non-cgi executable files or our private data
<FilesMatch (\.pm|\.pl|\.tmpl|localconfig.*)$>
deny from all
</FilesMatch>
<IfModule mod_expires.c>
<IfModule mod_headers.c>
<IfModule mod_env.c>
<FilesMatch (\.js|\.css)$>
ExpiresActive On
# According to RFC 2616, "1 year in the future" means "never expire".
# We change the name of the file's URL whenever its modification date
# changes, so browsers can cache any individual JS or CSS URL forever.
# However, since all JS and CSS URLs involve a ? in them (for the changing
# name) we have to explicitly set an Expires header or browsers won't
# *ever* cache them.
ExpiresDefault "now plus 1 years"
Header append Cache-Control "public"
</FilesMatch>
# This lets Bugzilla know that we are properly sending Cache-Control
# and Expires headers for CSS and JS files.
SetEnv BZ_CACHE_CONTROL 1
</IfModule>
</IfModule>
</IfModule>
AddHandler cgi-script .cgi .pl
DirectoryIndex index.cgi
这是.htaccess
目录上方bugzilla
目录的文件。这是public_html
网络根:
DirectoryIndex index.html
这是该站点的 Apache 配置文件:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/default/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/default/public_html>
DirectoryIndex index.cgi
AllowOverride Limit FileInfo Indexes
AddHandler cgi-script .cgi
Options Indexes FollowSymLinks MultiViews +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
请注意,即使该目录中的非 Bugzilla 静态 HTML 文件也会受到影响。例如,我/bugzilla/test.html
在 VIM 中创建,然后尝试在浏览器中访问它并看到它也在返回403/Forbidden
. 该目录内外的所有文件都具有相同的用户ubuntu
和相同的权限644
。bugzilla
目录本身有权限755
,它的父目录也有权限public_html
。
服务器上没有安装诸如 Plesk 之类的“控制面板”,所有配置都在 Apache 配置文件中完成。为什么 Apache 可能决定我可能无权查看该bugzilla
目录?这是在 Ubuntu Server 12.04 LTS 上托管在 Amazon Web Services 中的公共网络服务器上。