xref: /lighttpd1.4/doc/config/conf.d/fastcgi.conf (revision 63a578fe)
1#######################################################################
2##
3##  FastCGI Module
4## ---------------
5##
6## See https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI
7##
8server.modules += ( "mod_fastcgi" )
9
10##
11## PHP Example
12## For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.
13##
14## The number of php processes you will get can be easily calculated:
15##
16## num-procs = max-procs * ( 1 + PHP_FCGI_CHILDREN )
17##
18## for the php-num-procs example it means you will get 17*5 = 85 php
19## processes. you always should need this high number for your very
20## busy sites. And if you have a lot of RAM. :)
21##
22#fastcgi.server = ( ".php" =>
23#                   ( "php-local" =>
24#                     (
25#                       "socket" => socket_dir + "/php-fastcgi-1.socket",
26#                       "bin-path" => server_root + "/cgi-bin/php5",
27#                       "max-procs" => 1,
28#                       "broken-scriptfilename" => "enable",
29#                     ),
30#                     "php-tcp" =>
31#                     (
32#                       "host" => "127.0.0.1",
33#                       "port" => 9999,
34#                       "check-local" => "disable",
35#                       "broken-scriptfilename" => "enable",
36#                     ),
37#                     "php-num-procs" =>
38#                     (
39#                       "socket" => socket_dir + "/php-fastcgi-2.socket",
40#                       "bin-path" => server_root + "/cgi-bin/php5",
41#                       "bin-environment" => (
42#                         "PHP_FCGI_CHILDREN" => "16",
43#                         "PHP_FCGI_MAX_REQUESTS" => "10000",
44#                       ),
45#                       "max-procs" => 5,
46#                       "broken-scriptfilename" => "enable",
47#                     ),
48#                   ),
49#                 )
50
51##
52## Ruby on Rails Example
53##
54## Normally you only run one Rails application on one vhost.
55##
56#$HTTP["host"] == "rails1.example.com" {
57#  server.document-root  = server_root + "/rails/someapp/public"
58#  server.error-handler-404 = "/dispatch.fcgi"
59#  fastcgi.server = ( ".fcgi" =>
60#    ("someapp" =>
61#      ( "socket" => socket_dir + "/someapp-fcgi.socket",
62#        "bin-path" => server_root + "/rails/someapp/public/dispatch.fcgi",
63#        "bin-environment" => (
64#              "RAILS_ENV" => "production",
65#              "TMP" => home_dir + "/rails/someapp",
66#        ),
67#      )
68#    )
69#  )
70#}
71
72##
73## Another example with multiple rails applications on one vhost.
74##
75## https://blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-multiple-rails-apps
76##
77#$HTTP["host"] == "rails2.example.com" {
78#  $HTTP["url"] =~ "^/someapp1" {
79#    server.document-root  = server_root + "/rails/someapp1/public"
80#    server.error-handler-404 = "/dispatch.fcgi"
81#    fastcgi.server = ( ".fcgi" =>
82#      ("someapp1" =>
83#        ( "socket" => socket_dir + "/someapp1-fcgi.socket",
84#          "bin-path" => server_root + "/rails/someapp1/public/dispatch.fcgi",
85#          "bin-environment" => (
86#                "RAILS_ENV" => "production",
87#                "TMP" => home_dir + "/rails/someapp1",
88#          ),
89#          "strip-request-uri" => "/someapp1/"
90#        )
91#      )
92#    )
93#  }
94#
95#  $HTTP["url"] =~ "^/someapp2" {
96#    server.document-root  = server_root + "/rails/someapp2/public"
97#    server.error-handler-404 = "/dispatch.fcgi"
98#    fastcgi.server = ( ".fcgi" =>
99#      ("someapp2" =>
100#        ( "socket" => socket_dir + "/someapp2-fcgi.socket",
101#          "bin-path" => server_root + "/rails/someapp2/public/dispatch.fcgi",
102#          "bin-environment" => (
103#                "RAILS_ENV" => "production",
104#                "TMP" => home_dir + "/rails/someapp2",
105#          ),
106#          "strip-request-uri" => "/someapp2/"
107#        )
108#      )
109#    )
110#  }
111#}
112
113## chrooted webserver + external PHP
114##
115## $ spawn-fcgi -f /usr/bin/php-cgi -p 2000 -a 127.0.0.1 -C 8
116##
117## webserver chrooted to /srv/www/
118## php running outside the chroot
119#
120#fastcgi.server = (
121#  ".php" => ((
122#    "host" => "127.0.0.1",
123#    "port" => "2000",
124#    "docroot" => "/srv/www/servers/www.example.org/htdocs/"
125#  )))
126#
127#server.chroot = "/srv/www"
128#server.document-root = "/servers/www.example.org/htdocs/"
129#
130
131##
132#######################################################################
133