Skip to content
Myr

Add detailed Apache httpd fastcgi configuration.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Vadim Pestovnikov · committed by Ron DuPlain · parent a3cb2a3 · Browse files · 1 file+57 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+57 added−3 removed

  • other:+57 added−3 removed

1 file+57 added−3 removed

modified:docs/deploying/fastcgi.rst+57 added-3 removed
49 unmodified lines
50.. sourcecode:: text5152 # chmod +x /var/www/yourapplication/yourapplication.fcgi5354Configuring Apache55------------------5657The example above is good enough for a basic Apache deployment but your `.fcgi` file will appear in your application URL e.g. www.example.com/yourapplication.fcgi/news/. There are few ways to resolve it. A preferable way is to use Apache ScriptAlias configuration directive::5859 <VirtualHost *>60 ServerName example.com61 ScriptAlias / /path/to/yourapplication.fcgi/62 </VirtualHost>6364Another way is to use a custom WSGI middleware. For example on a shared web hosting::6566 .htaccess6768 <IfModule mod_fcgid.c>69 AddHandler fcgid-script .fcgi70 <Files ~ (\.fcgi)>71 SetHandler fcgid-script72 Options +FollowSymLinks +ExecCGI73 </Files>74 </IfModule>7576 <IfModule mod_rewrite.c>77 Options +FollowSymlinks78 RewriteEngine On79 RewriteBase /80 RewriteCond %{REQUEST_FILENAME} !-f81 RewriteRule ^(.*)$ yourapplication.fcgi/$1 [QSA,L]82 </IfModule>8384 yourapplication.fcgi8586 #!/usr/bin/python87 #: optional path to your local python site-packages folder88 import sys89 sys.path.insert(0, '<your_local_path>/lib/python2.6/site-packages')9091 from flup.server.fcgi import WSGIServer92 from yourapplication import app9394 class ScriptNameStripper(object):95 to_strip = '/yourapplication.fcgi'9697 def __init__(self, app):98 self.app = app99100 def __call__(self, environ, start_response):101 environ['SCRIPT_NAME'] = ''102 return self.app(environ, start_response)103104 app = ScriptNameStripper(app)105106 if __name__ == '__main__':107 WSGIServer(app).run()108109Configuring lighttpd110--------------------111112A basic FastCGI configuration for lighttpd looks like that::
25 unmodified lines
138root. Also, see the Lighty docs for more information on `FastCGI and139Python <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_140(note that explicitly passing a socket to run() is no longer necessary).14187142Configuring nginx143-----------------144145Installing FastCGI applications on nginx is a bit different because by
4 unmodified lines
150 location = /yourapplication { rewrite ^ /yourapplication/ last; }151 location /yourapplication { try_files $uri @yourapplication; }152 location @yourapplication {153 include fastcgi_params;100 fastcgi_split_path_info ^(/yourapplication)(.*)$;154 fastcgi_split_path_info ^(/yourapplication)(.*)$;155 fastcgi_param PATH_INFO $fastcgi_path_info;156 fastcgi_param SCRIPT_NAME $fastcgi_script_name;157 fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;158 }
54 unmodified lines
213214.. _nginx: http://nginx.org/215.. _lighttpd: http://www.lighttpd.net/216.. _cherokee: http://www.cherokee-project.com/163.. _flup: http://trac.saddi.com/flup217.. _flup: http://trac.saddi.com/flup