Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

More proofreading to docs/fastcgi.txt. Still not finished.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2211eddb362b79cc58cb289207ff4a4bec46b81c 1 parent 2837455
Adrian Holovaty authored June 26, 2006

Showing 1 changed file with 51 additions and 19 deletions. Show diff stats Hide diff stats

  1. 70  docs/fastcgi.txt
70  docs/fastcgi.txt
@@ -120,18 +120,53 @@ Apache setup
120 120
 ============
121 121
 
122 122
 To use Django with Apache and FastCGI, you'll need Apache installed and
123  
-configured, with mod_fastcgi installed and enabled. Consult the Apache
  123
+configured, with `mod_fastcgi`_ installed and enabled. Consult the Apache
124 124
 documentation for instructions.
125 125
 
126  
-Add the following to your ``httpd.conf``::
  126
+Once you've got that set up, point Apache at your Django FastCGI instance by
  127
+editing the ``httpd.conf`` (Apache configuration) file. You'll need to do two
  128
+things:
127 129
 
128  
-    # Connect to FastCGI via a socket / named pipe
  130
+    * Use the ``FastCGIExternalServer`` directive to specify the location of
  131
+      your FastCGI server.
  132
+    * Use ``mod_rewrite`` to point URLs at FastCGI as appropriate.
  133
+
  134
+.. _mod_fastcgi: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
  135
+
  136
+Specifying the location of the FastCGI server
  137
+---------------------------------------------
  138
+
  139
+The ``FastCGIExternalServer`` directive tells Apache how to find your FastCGI
  140
+server. As the `FastCGIExternalServer docs`_ explain, you can specify either a
  141
+``socket`` or a ``host``. Here are examples of both::
  142
+
  143
+    # Connect to FastCGI via a socket / named pipe.
129 144
     FastCGIExternalServer /home/user/public_html/mysite.fcgi -socket /home/user/mysite.sock
130  
-    # Connect to FastCGI via a TCP host/port
131  
-    # FastCGIExternalServer /home/user/public_html/mysite.fcgi -host 127.0.0.1:3033
132 145
 
133  
-    <VirtualHost 64.92.160.91>
134  
-      ServerName mysite.com
  146
+    # Connect to FastCGI via a TCP host/port.
  147
+    FastCGIExternalServer /home/user/public_html/mysite.fcgi -host 127.0.0.1:3033
  148
+
  149
+In either case, the file ``/home/user/public_html/mysite.fcgi`` doesn't
  150
+actually have to exist. It's just a URL used by the Web server internally -- a
  151
+hook for signifying which requests at a URL should be handled by FastCGI. (More
  152
+on this in the next section.)
  153
+
  154
+.. _FastCGIExternalServer docs: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer
  155
+
  156
+Using mod_rewrite to point URLs at FastCGI
  157
+------------------------------------------
  158
+
  159
+The second step is telling Apache to use FastCGI for URLs that match a certain
  160
+pattern. To do this, use the `mod_rewrite`_ module and rewrite URLs to
  161
+``mysite.fcgi`` (or whatever you specified in the ``FastCGIExternalServer``
  162
+directive, as explained in the previous section).
  163
+
  164
+In this example, we tell Apache to use FastCGI to handle any request that
  165
+doesn't represent a file on the filesystem and doesn't start with ``/media/``.
  166
+This is probably the most common case, if you're using Django's admin site::
  167
+
  168
+    <VirtualHost 12.34.56.78>
  169
+      ServerName example.com
135 170
       DocumentRoot /home/user/public_html
136 171
       Alias /media /home/user/python/django/contrib/admin/media
137 172
       RewriteEngine On
@@ -140,18 +175,15 @@ Add the following to your ``httpd.conf``::
140 175
       RewriteRule ^/(.*)$ /mysite.fcgi/$1 [QSA,L]
141 176
     </VirtualHost>
142 177
 
143  
-Note that while you have to specify a mysite.fcgi, that this file doesn't
144  
-actually have to exist.  It is just an internal URL to the webserver which
145  
-signifies that any requests to that URL will go to the external FastCGI
146  
-server.
  178
+.. _mod_rewrite: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
147 179
 
148  
-LigHTTPd Setup
  180
+lighttpd setup
149 181
 ==============
150 182
 
151  
-LigHTTPd is a light-weight asynchronous web-server, which is commonly used
152  
-for serving static files.  However, it supports FastCGI natively, and as such
153  
-is a very good choice for serving both static and dynamic media, if your site
154  
-does not have any apache-specific components.
  183
+lighttpd is a light-weight asynchronous Web server commonly used for serving
  184
+static files. It supports FastCGI natively, though, and thus is a good choice
  185
+for serving both static and dynamic pages, if your site doesn't have any
  186
+Apache-specific components.
155 187
 
156 188
 Make sure ``mod_fastcgi`` is in your modules list, somewhere after
157 189
 mod_rewrite and mod_access, but not after mod_accesslog.  You'll probably
@@ -165,7 +197,7 @@ Add the following to your lighttpd config file::
165 197
             "main" => (
166 198
                 # Use host / port instead of socket for TCP fastcgi
167 199
                 # "host" => "127.0.0.1",
168  
-                # "port"  => 3033,
  200
+                # "port" => 3033,
169 201
                 "socket" => "/home/user/mysite.sock",
170 202
                 "check-local" => "disable",
171 203
             )
@@ -181,10 +213,10 @@ Add the following to your lighttpd config file::
181 213
         "^(/.*)$" => "/mysite.fcgi$1",
182 214
     )
183 215
 
184  
-Running multiple django sites on one LigHTTPd
  216
+Running multiple django sites on one lighttpd
185 217
 ---------------------------------------------
186 218
 
187  
-LigHTTPd allows you to use what is called conditional configuration to allow
  219
+lighttpd allows you to use what is called conditional configuration to allow
188 220
 configuration to be customized per-host.  In order to specify multiple fastcgi
189 221
 sites, simply add a conditional block around your fastcgi config for each site::
190 222
 

0 notes on commit 2211edd

Please sign in to comment.
Something went wrong with that request. Please try again.