403 禁止使用 fastcgi
尝试在 Windows 7 上使用 apache 2.2 和 fastcgi 来设置 ReviewBoard 服务器(不,Linux 不是选项)。我使用(基本上)默认的 httpd.conf,加载了 mod_fcgid 和 mod_rewrite,并且 在底部添加 C:\mars\reviews\conf\apache-fastcgi.conf
。这也是默认值,Order
、Allow
和 +Indexes
除外。问题是,当我尝试加载该网站时,我得到 /
403(根据重写规则,它会变成 reviewboard.fcgi
)。我添加了 +Indexes 来证明是的,事实上,我可以访问这些目录,所以这似乎不是权限问题。
当我添加 ExecCgi 时,那些 403 错误变成了 404 错误!我已无计可施,不知所措。
C:\mars\reviews\conf\apache-fastcgi.conf
的内容(已编辑 ServerName
):
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
FastCGIServer "c:/mars/reviews/htdocs/reviewboard.fcgi" -socket "c:/mars/reviews/tmp/fastcgi.sock"
</IfModule>
<VirtualHost *:80>
ServerName #redacted
DocumentRoot "c:/mars/reviews/htdocs"
# Alias static media requests to filesystem
Alias /media "c:/mars/reviews/htdocs/media"
Alias /errordocs "c:/mars/reviews/htdocs/errordocs"
# Error handlers
ErrorDocument 500 /errordocs/500.html
<Directory "c:/mars/reviews/htdocs">
Options +Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# Direct all other requests to the fastcgi server
RewriteEngine on
<IfModule mod_fcgid.c>
RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
RewriteRule ^/(errordocs.*)$ /$1 [QSA,L,PT]
</IfModule>
<IfModule mod_fastcgi.c>
RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
RewriteRule ^/(errordocs.*)$ /$1 [QSA,L,PT]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ /reviewboard.fcgi/$1 [QSA,L]
</VirtualHost>
这里到底出了什么问题?
Trying to set up a ReviewBoard server, using apache 2.2 with fastcgi on Windows 7 (no, Linux isn't an option). I'm using (basically) the default httpd.conf, with mod_fcgid and mod_rewrite loaded, andInclude C:\mars\reviews\conf\apache-fastcgi.conf
added at the bottom. This too is the default, excepting the Order
, Allow
, and +Indexes
. The trouble is, when I attempt to load the site, I get 403 for /
(which, according to the rewrite rule, would become reviewboard.fcgi
). I added +Indexes
to prove that yes, in fact, I can access those directories, so it doesn`t appear to be a permissions problem.
When I add ExecCgi
, those 403 errors turn into 404 errors! I'm at my wits end, and over my head.
The contents of C:\mars\reviews\conf\apache-fastcgi.conf
(with ServerName
redacted):
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
FastCGIServer "c:/mars/reviews/htdocs/reviewboard.fcgi" -socket "c:/mars/reviews/tmp/fastcgi.sock"
</IfModule>
<VirtualHost *:80>
ServerName #redacted
DocumentRoot "c:/mars/reviews/htdocs"
# Alias static media requests to filesystem
Alias /media "c:/mars/reviews/htdocs/media"
Alias /errordocs "c:/mars/reviews/htdocs/errordocs"
# Error handlers
ErrorDocument 500 /errordocs/500.html
<Directory "c:/mars/reviews/htdocs">
Options +Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# Direct all other requests to the fastcgi server
RewriteEngine on
<IfModule mod_fcgid.c>
RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
RewriteRule ^/(errordocs.*)$ /$1 [QSA,L,PT]
</IfModule>
<IfModule mod_fastcgi.c>
RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
RewriteRule ^/(errordocs.*)$ /$1 [QSA,L,PT]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ /reviewboard.fcgi/$1 [QSA,L]
</VirtualHost>
What on Earth is going wrong here??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我看来,您已经安装了 mod_fcgid,但 FastCGIServer 语句位于 mod_fastcgi-section 中。我就是从这里开始的。
It seems to me, that you have mod_fcgid installed, but FastCGIServer-statement is in mod_fastcgi-section. I'd started here.
在与 ReviewBoard 的 Christian Hammond 交谈后,他向我推荐了这张 django 票。原来django在Windows上不支持FastCGI!
After speaking with Christian Hammond at ReviewBoard, he pointed me to this django ticket. It turns out that django doesn't support FastCGI on Windows!