| 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. |
|---|
| | 183 | lighttpd is a lightweight Web server commonly used for serving static files. It |
|---|
| | 184 | supports FastCGI natively and, thus, is a good choice for serving both static |
|---|
| | 185 | and dynamic pages, if your site doesn't have any Apache-specific needs. |
|---|
| 219 | | lighttpd allows you to use what is called conditional configuration to allow |
|---|
| 220 | | configuration to be customized per-host. In order to specify multiple fastcgi |
|---|
| 221 | | sites, simply add a conditional block around your fastcgi config for each site:: |
|---|
| 222 | | |
|---|
| 223 | | $HTTP["host"] == "www.website1.com" { |
|---|
| | 218 | lighttpd lets you use "conditional configuration" to allow configuration to be |
|---|
| | 219 | customized per host. To specify multiple FastCGI sites, just add a conditional |
|---|
| | 220 | block around your FastCGI config for each site:: |
|---|
| | 221 | |
|---|
| | 222 | # If the hostname is 'www.example1.com'... |
|---|
| | 223 | $HTTP["host"] == "www.example1.com" { |
|---|
| 239 | | You can also run multiple django installations on the same site simply by |
|---|
| 240 | | specifying multiple entries in the ``fastcgi.server`` directive, add one |
|---|
| 241 | | fastcgi host for each. |
|---|
| 242 | | |
|---|
| 243 | | Running Django on a shared-hosting provider |
|---|
| 244 | | =========================================== |
|---|
| 245 | | |
|---|
| 246 | | For many users on shared-hosting providers, you aren't able to run your own |
|---|
| 247 | | server daemons nor do they have access to the httpd.conf of their webserver. |
|---|
| 248 | | However, it is still possible to run Django using webserver-spawned processes. |
|---|
| | 240 | You can also run multiple Django installations on the same site simply by |
|---|
| | 241 | specifying multiple entries in the ``fastcgi.server`` directive. Add one |
|---|
| | 242 | FastCGI host for each. |
|---|
| | 243 | |
|---|
| | 244 | Running Django on a shared-hosting provider with Apache |
|---|
| | 245 | ======================================================= |
|---|
| | 246 | |
|---|
| | 247 | Many shared-hosting providers don't allow you to run your own server daemons or |
|---|
| | 248 | edit the ``httpd.conf`` file. In these cases, it's still possible to run Django |
|---|
| | 249 | using Web server-spawned processes. |
|---|
| 252 | | If you are using webserver-managed processes, there's no need for you |
|---|
| 253 | | to start the FastCGI server on your own. Apache will spawn a number |
|---|
| 254 | | of processes, scaling as it needs to. |
|---|
| 255 | | |
|---|
| 256 | | In your web root directory, add this to a file named .htaccess :: |
|---|
| | 253 | If you're using Web server-spawned processes, as explained in this section, |
|---|
| | 254 | there's no need for you to start the FastCGI server on your own. Apache |
|---|
| | 255 | will spawn a number of processes, scaling as it needs to. |
|---|
| | 256 | |
|---|
| | 257 | In your Web root directory, add this to a file named ``.htaccess`` :: |
|---|
| 285 | | If you change the code of your site, to make apache re-load your django |
|---|
| 286 | | application, you do not need to restart the server. Simply re-upload or |
|---|
| 287 | | edit your ``mysite.fcgi`` in such a way that the timestamp on the file |
|---|
| 288 | | will change. When apache sees that the file has been updated, it will |
|---|
| 289 | | restart your django application for you. |
|---|
| 290 | | |
|---|
| 291 | | If you have access to a command shell on a unix system, restarting the |
|---|
| 292 | | server can be done with the ``touch`` command:: |
|---|
| | 286 | If you change any Python code on your site, you'll need to tell FastCGI the |
|---|
| | 287 | code has changed. But there's no need to restart Apache in this case. Rather, |
|---|
| | 288 | just reupload ``mysite.fcgi``, or edit the file, so that the timestamp on the |
|---|
| | 289 | file will change. When Apache sees the file has been updated, it will restart |
|---|
| | 290 | your Django application for you. |
|---|
| | 291 | |
|---|
| | 292 | If you have access to a command shell on a Unix system, you can accomplish this |
|---|
| | 293 | easily by using the ``touch`` command:: |
|---|