1. Download Lighttpd, PCRE, PHP, and other related extension packages
2. Install PCRE
./configure & make install
install PHP
. /configure -- prefix =/usr/local/PHP/-- With-mysql =/usr/local/MySQL -- With-Gd =/usr/local/GD -- With-libxml-Dir -- With-zlib =/usr/local/zlib -- With-curl -- With-libxml-Dir =/usr/local/libxml -- enable-EXIF -- enable-soap -- enable-sockets -- With-JPEG-Dir =/usr/local/JPEG -- With-PNG-Dir =/usr/local/PNG -- With-TTF -- With-FreeType-Dir =/usr/ local/FreeType -- With-ming =/usr/local/Libing -- enable-sqlite-utf8 -- With-XSL =/usr/local/libxslt -- enable-Zend-multibyte -- enable-shared -- enable- mbstring -- enable-Zend-multibyte -- With-XMLRPC -- enable-FastCGI -- enable-force-CGI-redirect
note:
extended -- enable-FastCGI -- enable-force-CGI-redirect will be generated (bin/PHP-CGI execution file)
do not bring -- with-apxs2 =/usr/local/apache2/bin/apxs (after the installation, the PHP Execution file is in CLI mode)
# Make & make install
Install Lighttpd
./Configure -- prefix =/usr/local/Lighttpd & make install
3. Create or copy the Lighttpd. conf STARTUP configuration file
Switch to the root directory/doc of the source code package
# Cp Lighttpd. CONF/usr/local/Lighttpd. conf
Start the Lighttpd method:
#/Usr/local/Lighttpd/sbin/Lighttpd-F/usr/local/Lighttpd. conf
The installation is successful, and you can access it normally!
4. Configure as System Service
Switch to/usr/local/Lighttpd/sbin at each start and execute./Lighttpd-F/usr/local/Lighttpd. conf is troublesome and cannot be restarted!
Switch to the root directory of the source code package:
# Cd Doc
# Cp sysconfig. Lighttpd/etc/sysconfg/Lighttpd
# Cat/etc/sysconfg/Lighttpd
The content is as follows: lighttpd_conf_path =/etc/Lighttpd. conf. modify it to the corresponding configuration file directory/usr/local/Lighttpd. conf.
# Cp RC. Lighttpd. RedHat/etc/init. d/Lighttpd
# Cat/etc/init. d/Lighttpd
Modify Lighttpd = "/usr/sbin/Lighttpd" to the installation directory/usr/lcoal/Lighttpd/sbin/Lighttpd.
You want to start Lighttpd when the server is started:
# Chkconfig Lighttpd on
Command operation: Service Lighttpd [command]: [Start | stop | restart | condrestart | reload | status]
5. Configure Lighttpd to support PHP, CGI, etc...
FastCGI. Server = (". php" =>
("Localhost" =>
(
"Socket" => "/tmp/php-fastcgi.socket ",
"Bin-path" => "/usr/local/PHP/bin/PHP-cgi"
)
)
)
6. Install spawn-fcgi and manage the FastCGI process.
#./Configure -- prefix =/usr/local/spawn-fcgi & make install
Go to the root directory of the Lighttpd source code package:
# Cd Doc
# Cp spawn-php.sh/usr/local/Lighttpd/spawn-php.sh
Modify content
# Absolute path to the spawn-fcgi binary
Spawnfcgi = "/usr/local/Lighttpd/bin/spawn-fcgi"
# Absolute path to the PHP binary
Fcgiprogram = "/usr/local/PHP/bin/PHP-cgi"