简体   繁体   English

Apache在FastCGI VirtualHost上给出400错误

[英]Apache giving a 400 Error on a FastCGI VirtualHost

Apache is spitting out a HTTP response of code: 400 "Bad Request" with no details whenever I access a page driven that is handled by a FastCGI script. 每当我访问由FastCGI脚本处理的页面驱动时,Apache都会发出HTTP响应代码:400“ Bad Request”,没有详细信息。

  • I've installed the mod_fcgid module and it's loaded and configured in the Apache config files 我已经安装了mod_fcgid模块,并在Apache配置文件中对其进行了加载和配置
  • I've tested several FastCGI scripts, all of them run when directly executed. 我已经测试了几个FastCGI脚本,它们都在直接执行时运行。
  • Static resources are served appropriately. 静态资源得到适当服务。
  • Apache is trying to launch the script because it complains when I rewrite the URL to a non-existant script Apache正在尝试启动脚本,因为当我将URL重写为不存在的脚本时它会抱怨

Anyone have any idea what's wrong with my Apache Config? 有人知道我的Apache Config有什么问题吗?

<VirtualHost ip.ad.re.ss:80>
  ServerName   demo.domain.com:80 

  DocumentRoot /var/www/vhosts/domain.com/subdomains/demo/rails/public
  CustomLog  /var/www/vhosts/domain.com/statistics/logs/demo_access_log combined
  ErrorLog  /var/www/vhosts/domain.com/statistics/logs/demo_error_log
  LogLevel info
  Options +FollowSymLinks +ExecCGI -SymLinksIfOwnerMatch
  AddHandler fcgid-script .fcgi

  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</VirtualHost>

EDIT -- I've checked the mod_rewrite logs and URI's are being rewritten correctly 编辑-我已经检查了mod_rewrite日志和URI是否已正确重写

Try removing the DOCUMENT_ROOT rewrite cond. 尝试删除DOCUMENT_ROOT重写条件。 Second, checkout the mod_rewrite log directives, they're extremely informative as far as weird issues like this. 其次,签出mod_rewrite日志指令,它们对于此类奇怪的问题非常有用。

Alright, one more thing to try. 好了,再尝试一件事。
http://httpd.apache.org/docs/2.2/mod/core.html#loglevel . http://httpd.apache.org/docs/2.2/mod/core.html#loglevel

Set the log level to debug and make sure this is not on a production machine because it produces a lot of output per individual event (get/put). 设置日志级别以进行调试,并确保此日志级别不在生产机器上,因为它会为每个事件(获取/输出)产生大量输出。

I think how your example above of FastCGI is missing something, but I admit its been a while since I've done anything but php or python fastcgi. 我认为您在FastCGI上面的示例丢失了一些东西,但是我承认这已经有一段时间了,因为除了PHP或python fastcgi之外我什么都没做。
What language is dispatch.fcgi in? dispatch.fcgi用什么语言? Can you execute it from the command line and does Apache have permission to execute the file? 您可以从命令行执行它吗,Apache有权执行该文件吗? ( sudo su apacheaccount ). (sudo su apacheaccount)。

Update: Knew you were missing something: check out -> http://fastcgi.coremail.cn/configuration.htm FCGIWrapper is needed to tell fast cgi what to use to execute your dispatch.fcgi file. 更新:知道您缺少什么:检出-> http://fastcgi.coremail.cn/configuration.htm需要FCGIWrapper来告诉Fast CGI使用什么来执行您的dispatch.fcgi文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM