Installing Lighttpd on CentOS

1.Getting the RPM:

rpm -Uhv

2. yum install lighttpd
3. yum install lighttpd-fastcgi php-cli
4. edit using sftp or vid command: /etc/lighttpd/lighttpd.conf
5. Search and edit: server.use-ipv6 = “disable”
6. edit using sftp or vid command: /etc/lighttpd/modules.conf
7. Search: 

server.modules = ( “mod_access”, # “mod_alias”, # “mod_auth”, # “mod_evasive”, # “mod_redirect”, # “mod_rewrite”, # “mod_setenv”, # “mod_usertrack”, )

Edit to:

server.modules = ( “mod_access”, “mod_alias”, “mod_auth”, “mod_evasive”, “mod_redirect”, “mod_rewrite”, “mod_setenv”, “mod_usertrack”, )

now scroll down and Search

## ## FastCGI (mod_fastcgi) ## #include “conf.d/fastcgi.conf”

and change for

## ## FastCGI (mod_fastcgi) ## include “conf.d/fastcgi.conf” fastcgi.server = ( “.php” => ( “localhost” => ( “socket” => “/tmp/php-fastcgi.socket”, “bin-path” => “/usr/bin/php-cgi” ) ) )

Now everything its ok, I recommend to you to put an index.html in var/www/lighttpd because by default lighttpd give you an 404 error (chrome show me this like broken link that was my first fail)

Next! ===> 30%

8. Installing gcc for compailing
yum install gcc gcc-c++ autoconf automake

9. Installing Pkgconfig 


tar xvf pkg-config-0.23.tar.gz
cd pkg-config-0.23
make install
cd ..

10. Installing Lua

You will also need to download latest version of Lua for mod_magnet to be installed correctly.
Download latest version of Lua (This is needed for mod_magnet)
Use wget command to download the latest Lua:


Use tar to uncompress the file:
tar xvf lua-5.1.4.tar.gz

Go into the directory of Lua:
cd lua-5.1.4

Use the following command for compiling:
(These instructions are for either Fedora or CentOS, if you are on different linux OS, you will need to read the README)

make linux

*Note: If you get readline errors, try: (that means you don’t have readline development packages installed)

yum install readline-devel

*Note: If you get errors like this “/usr/bin/ld: cannot find -lncurses”, try:

yum install ncurses-devel

If everything goes well, do make install:

make install

Next, copy lua.pc to /usr/lib/pkgconfig where your pkgconfig is installed:

cp etc/lua.pc /usr/lib/pkgconfig

Do ranlib command:

ranlib src/liblua.a

Back to working directory:

cd ..

11. remove Apache:
/sbin/service httpd stop
chkconfig httpd off
rpm -e httpd
chkconfig lighttpd –add
chkconfig lighttpd on
chkconfig –list

12. installing mysql
yum install mysql mysql-server
chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start

13.Create a password for the MySQL user root (replace yourrootsqlpassword with the password you want to use):

mysqladmin -u root password yourrootsqlpassword

14. Then check with

netstat -tap | grep mysql

on which addresses MySQL is listening. If the output looks like this:

tcp 0 0 localhost.localdo:mysql *:* LISTEN 2713/mysqld

which means MySQL is listening on localhost.localdomain only, then you’re safe with the password you set before. But if the output looks like this:

tcp 0 0 *:mysql *:* LISTEN 2713/mysqld

14. reboot
15. edit lighttpd.conf for permalinks (wordpress)

url.rewrite-once = ( “^/robots.txt” => “$0”, “^/(wp-.+).*/?” => “$0”, “^/(sitemap.xml)” => “$0”, “^/(xmlrpc.php)” => “$0”, “^/keyword/([A-Za-z_0-9-]+)/?$” => “/index.php?keyword=$1”, “^/.*?(?.*)?$” => “/index.php$1” )