Log in |
FastCGI, virtualhosts and root foldersHow it works:
LoadModule fastcgi_module libexec/mod_fastcgi.so
LoadModule rewrite_module libexec/mod_rewrite.so
AddModule mod_fastcgi.c
AddModule mod_rewrite.c
FastCgiExternalServer /disk1/fastcgi/zope.fcgi -host localhost:8889 \
-pass-header Authorization
Then I created a virtual host:
<VirtualHost 12.34.56.78> ServerAdmin helpdesk@my.domain DocumentRoot /disk1/htdocs ServerName fastcgi.my.domain ServerAlias fastcgi DirectoryIndex index_html RewriteEngine On RewriteRule .*\.php - [L] RewriteRule ^/(.*) /disk1/fastcgi/zope.fcgi/$1 [L] <Directory /disk1/fastcgi> AddHandler fastcgi-script .fcgi AllowOverride none Options ExecCGI Order allow,deny Allow from all </Directory> </VirtualHost> The file /disk1/fastcgi/zope.fcgi doesn't have to exist, but the directory most likely must. Otherwise Apache will write a warning in error_log. About the FastCGI module As I also want WEBDAV to work I have commented
out some lines in mod_fastcgi.c line 1358:
/* We don't do anything but GET and POST */
#if 0
if (r->method_number == M_OPTIONS) {
r->allowed |= (1 << M_GET);
r->allowed |= (1 << M_POST);
return DECLINED;
}
#endif
Vanilla FastCGI simply checks if the method is GET or POST and declines if otherwise. If you want to serve PHP as well as Zope You will also want to avoid that people can do funny tricks with your PHP scripts through WEBDAV, so you add these lines somewhere near the bottom of your <VirtualHost> envelope.
<LocationMatch ".*\.php">
<Limit PUT DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
order deny,allow
deny from all
</Limit>
</LocationMatch>
|