Lighttpd configuration full contact (2) -- FastCGI PHP configuration

Source: Internet
Author: User
Tags unix domain socket

 

Official FastCGI efficiency Configuration

Http://redmine.lighttpd.net/wiki/1/Docs:PerformanceFastCGI

 

FastCGI is faster than CGI, mainly because the CGI service process has been providing services and does not want CGI to start and end a CGI process every time a request is sent.

Webserver can communicate with common TCP/IP socket through Unix domain socket. Another advantage introduced here is that FastCGI and weberver can

Run on different machines.

Use PHP for FastCGI. In fact, Perl and so on can all be used. After installing php In ubuntu, there will be/usr/bin/PHP and/usr/bin/PHP-CGI. The two are different.

The former does not support CGI and the latter does not support CGI. From the output, PHP-CGI will output two more lines,

X-powered-by: PHP/5.3.2-1ubuntu4. 7

Content-Type: text/html

 

 

FastCGI configuration of Lighttpd

FastCGI. debug log level. Currently there are 0 and 1 levels. The default value is 0. If it is set to 1, many logs are output.

Ing of the suffix FastCGI. Map-extensions, for example, FastCGI. Map-extensions = (". php3" => ". php ")

FastCGI. Server specific FastCGI Configuration

FastCGI. Server =

("Extension" =>

(

("Host" => 192.68.4.4,

"Port" = & gt; 9090

)

("Host" => 192.68.4.3,

"Port" = & gt; 9090

)

)

)

 

 

Extension: The suffix of the file name, or the prefix (if the prefix must start)

 

"Host": the server name of the FastCGI process, which can be an IP address or domain name

"Port": FastCGI process port number

"Socket": Unix-domain socket path. Because FastCGI processes can be the same machine as webserver or different machines. Therefore, host: port is used for different machines, and Unix domain socket is used for the same machine.

 

"Bin-path": FastCGI Local Binary File

 

 

"Mode": Is the FastCGI protocol mode.

Default is "responder", also "Authorizer"

Mode is implemented.

"Docroot ":

"Check-local": Check whether the requested file exists before sending it to FastCGI.

: "Broken-scriptfilename": breaks script_filename in a wat that

PHP can extract path_info from it (default: Disabled)

: "Disable-time": time to wait before a disabled backend is checked

Again

: "Allow-X-send-file": controls if X-Lighttpd-send-file headers

Are Allowed

: "Fix-root-scriptname": fix broken path-Info split for "/" extension ("prefix ")

 

If bin-path is set

 

"Max-procs": Maximum number of FastCGI Processes

"Bin-Environment": adds new configurations based on the current environment variables.

"Bin-copy-environement": fully utilizes the configured environment variables.

"Kill-signal": the signal that kills FastCGI. The default value is sigterm.

 

 

Suffix Configuration

FastCGI. Server = (". php" =>

("Host" => "127.0.0.1 ",

"Port" = & gt; 1026,

"Bin-path" => "/usr/local/bin/PHP"

)),

". PhP4" =>

("Host" => "127.0.0.1 ",

"Port" = & gt; 1026

))

)

 

Prefix Configuration

 

FastCGI. Server = ("/remote_scripts/" =>

("Host" => "192.168.0.3 ",

"Port" = & gt; 9000,

"Check-local" => "Disable ",

"Docroot" => "/" # remote server may use

# It's own docroot

))

)

 

 

Server Load balancer configuration, must be the same suffix/prefix to specify multiple FastCGI backend

FastCGI. Server = (". php" =>

("Host" => "10.0.0.2", "Port" => 1030 ),

("Host" => "10.0.0.3", "Port" => 1030 ))

)

 

 

The external FastCGI process can only be generated locally if it is directly written in Lighttpd. conf, and can be generated externally on the same machine.

Spawn-fcgi must be downloaded separately.

 

Sudo apt-Get install spawn-fcgi

Source code: http://download.lighttpd.net/spawn-fcgi/

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.