0

直到最近,一个内部的 Bugzilla 安装运行良好。现在,对目录内页面的所有请求都http://example.com/bugzilla返回403/Forbidden. 该目录之外的页面,例如在http://example.com/test.htmlhttp://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和相同的权限644bugzilla目录本身有权限755,它的父目录也有权限public_html

服务器上没有安装诸如 Plesk 之类的“控制面板”,所有配置都在 Apache 配置文件中完成。为什么 Apache 可能决定我可能无权查看该bugzilla目录?这是在 Ubuntu Server 12.04 LTS 上托管在 Amazon Web Services 中的公共网络服务器上。

4

2 回答 2

1

检查 error_log 文件,它通常包含关于为什么返回403 Forbidden.

于 2013-07-29T12:18:54.587 回答
1

(它看起来像一个 debian 服务器?如果你发布这样的问题,总是提到操作系统。)

我怀疑这是一个权利问题 - 错误的所有者。对于 debian/ubuntu,给定的文件夹及其文件应归用户“www-data”所有。对于 Centos/Redhat,我相信它应该是“nobody”。检查它,必要时更改它。

sudo chown -R www-data:www-data test

注意:如果您不确定更改权限,请先制作一份副本。更改副本的所有者,因为复制本身可能会更改所有者。或者使用 rsync 制作文件夹的副本,因为 rsync 保留所有者和权限。

于 2013-07-29T12:36:24.150 回答