
lighttpd (pronounced lighty) is a web server designed to be fast, secure, flexible, and faithful to standards.
It is optimized for environments where speed is very important, and therefore consumes less CPU and RAM memory than other servers. For everything it offers, lighttpd It is appropriate for any server that has loading problems.
lighttpd is free software and is distributed under the BSD license. Works in GNU/Linux andUNIX officially. For Microsoft Windows there is currently a distribution known as Lighttpd For Windows maintained by Kevin Worthington.
We download the code:
cd /usr/src
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.30.tar.gzWe decompress
tar -xzvf lighttpd-1.4.30.tar.gzWe access the folder
cd lighttpd-1.4.30We create the folder where we are going to install it.
mkdir /usr/local/lighttpdThe configuration will be default, we will install it in /usr/local/lighttpd and disable ipv6, zlib and bzip2
./configure --prefix=/usr/local/lighttpd --without-zlib --without-bzip2 --disable-ipv6If you get the following error when compiling:
configure: error: pcre-config not found, install the pcre-devel package or build with –without-pcre
It is because you are missing the libpcre libraries, we install them.
apt-get install libpcre3 libpcre3-dev
At the end we will see a summary of the configuration, activated and deactivated plugins.
Plugins:
enabled:
mod_access
mod_accesslog
mod_alias
mod_auth
mod_cgi
mod_compress
mod_dirlisting
mod_evhost
mod_expire
mod_extforward
mod_fastcgi
mod_flv_streaming
mod_indexfile
mod_proxy
mod_redirect
mod_rewrite
mod_rrdtool
mod_scgi
mod_secdownload
mod_setenv
mod_simple_vhost
mod_ssi
mod_staticfile
mod_status
mod_trigger_b4_dl
mod_userdir
mod_usertrack
mod_webdav
disabled:
mod_cml
mod_magnet
mod_mysql_vhostFeatures:
enabled:
auth-crypt
large-files
regex-conditionals
disabled:
auth-ldap
compress-bzip2
compress-deflate
compress-gzip
network-ipv6
network-openssl
stat-cache-fam
storage-gdbm
storage-memcache
webdav-locks
webdav-propertiesIf everything went well...we compile and install
make && make installWe create a user and group without a shell for the execution of the service.
# useradd -G lighttpd -s /sbin/nologin -d /var/www/html lighttp
# groupadd lighttpdWe create the log structure:
mkdir /var/log/lighttpdWe changed the owner and the group.
chown lighttpd:lighttpd /var/log/lighttpdWe create the folder where the configuration file will be hosted.
mkdir /etc/lighttpdWe copy the configuration files
cp ./doc/config/lighthttpd.conf /etc/lighthttpd/
cp -rp doc/config/conf.d/ /etc/lighttpd/
cp ./doc/config/modules.conf /etc/lighttpd/
cp -rp ./doc/config/vhosts.d/ /etc/lighthttpd/We fit the owner
chown lighttpd:root /etc/lighttpd/lighttpd.confWe copy the script to start/stop the service in init.d
cp ./doc/initscripts/rc.lighttpd /etc/init.d/lighttpdWe give execution permissions.
chmod u+x /etc/init.d/lighttpdWe check if we can access the web server with the IP address of the machine, in my case: http://192.168.1.185
Finally we are going to compile PHP and configure FastCGI
We download PHP
wget http://es2.php.net/get/php-5.3.10.tar.gzWe decompress
tar xvf php-5.3.10.tar.gzWe access
cd cd php-5.3.10/We install the necessary libraries.
apt-get install libmysqlclient15-dev libxml2-devWe configure
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql=/usr/bin/mysql --with-mysql --enable-ftp --disable-pdo --disable-ctypeWe compile and install
make && make installFinally, we add the following configuration to the file: lighttpd.conf
fastcgi.server = ( ".php" =>
("localhost" =>
("socket" => "/tmp/fcgi.socket",
"bin-path" => "/usr/local/php/bin/php-cgi"
)
)
)We restart Lighttpd and we should now be able to view php pages from the web server:
# /etc/init.d/lighttpd restartInstallation completed!
Greetings, rokitoh!
Comments