如何在apache中创build一个非常简单的外部FastCGIconfiguration?

我有一个外部启动的FastCGI应用程序,它侦听套接字“/tmp/foo.sock”和静态文件目录“/ srv / static”。 Apache在套接字和目录上都具有所需的权限。

我需要:所有以'/ static'开头的请求都应该由apache使用'/ srv / static'的内容来处理。 所有其他请求应该由FastCGI应用程序处理。 这是我目前的虚拟主机configuration:

<VirtualHost *:80> ServerAdmin [email protected] ServerName www.foo.com ServerAlias foo.com Alias /static /srv/static FastCgiExternalServer /* -socket /tmp/foo.sock ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined </VirtualHost> 

虽然这看起来很简单,但是让我很头痛。 根据http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer'FastCgiExternalServer '的第一个参数应该是'文件名',当匹配时会导致Apache将请求委托给外部的FastCGI应用程序。 我在这里错过了什么?

根据FastCGI常见问题解答 ,将FastCgiExternalServer行更改为FastCgiExternalServer的内容

 FastCgiExternalServer /srv/static -socket /tmp/foo.sock 

然后再试一次。

FastCgiExternalServer的第一个参数应该是一些将redirect的文件名。 它不一定存在。 它并不是说支持通配符。 我不认为使用/ srv / static是正确的答案,你希望由Apache处理。