Web Hosting Talk







View Full Version : Install lighttpd+PHP5 on CentOS


OscarS
04-25-2011, 07:05 PM
Hi everybody this is my first tutorial I'm not an expert but hope this will be helpful for someone.

This tutorial was tested on a Xen VPS 512RAM with CentOS 5.6 64bits

Well less chat and more guide.

First we need to add working repositores.

Add repo if you are 32bits

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Add repo if you are 64bits

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Install lighttpd

yum install lighttpd

Once lighttpd is installed you will need complements for php (we will use PHP5)

Install PHP

yum install lighttpd-fastcgi php-cli

Now we gonna set up our lighttpd configuration

Change settings of lighttpd

nano /etc/lighttpd/lighttpd.conf

This gonna open the file configuration of lighttpd we gonna disable IPv6 if we are using IPv4 (if not skip this)

Search "server.use-ipv6 = “enable”" and change for "disable"

server.use-ipv6 = "disable"

Now we gonna open the modules configuration file

Change settings of modules

nano /etc/lighttpd/modules.conf

Search

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

and change for

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

Note: in this step we change # in modules to active it.

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)

This tutorial is mine translate from spanish to english.

swisscloud
05-28-2011, 07:23 AM
Thanks for sharing. You may also want to add some php modules like mysql, curl, etc ... :)

zFastDan
06-10-2011, 07:30 AM
Great tutorial.

For some reason I had to put my index.html file in /srv/www/lighttpd

But apart from that, worked on a CentOS 5 32bit VPS!

Regards,
Daniel

serena85
06-10-2011, 07:32 AM
That is a great tutorial I have copied all:D

cptechie
06-10-2011, 07:36 AM
Hello,

Thanks for sharing the tutorial. It is really appreciable if members share such tutorials.

I will surely try it in my test server.

OscarS
06-10-2011, 12:34 PM
Great tutorial.

For some reason I had to put my index.html file in /srv/www/lighttpd

But apart from that, worked on a CentOS 5 32bit VPS!

Regards,
Daniel

Ya I know, was my bad, since we can't edit our old threads...

darwin7
06-17-2011, 01:58 AM
This script includes mysql?

OscarS
06-19-2011, 07:18 PM
This script includes mysql?

No, this doesnt include MYSQL you need to install as a single software.

ziao
07-06-2011, 02:27 PM
thanks i will try it

Xen Technologies
09-09-2011, 12:34 PM
thanks for you
will surely try it in my test server.

Erawan Arif Nugroho
01-17-2012, 08:39 AM
Is there any tutorial if I have the following case?

IPv6 Enabled VPS with /64 subnet.
More than 1 Domain name to be hosted in the VPS, for example :
www.domaina.com
www.domainb.com
www.anotherdomainofmine.com
www.forumwebsite.com


I want to server each domain name with each IPv6 address I have.

www.domaina.com = 2a02:2658:1011:1::2:1
Location = /var/www/www.domaina.com/html

www.domainb.com = 2a02:2658:1011:1::2:2
Location = /var/www/www.domainb.com

www.anotherdomainofmine.com = 2a02:2658:1011:1::2:3
Location = www.anotherdomainofmine.com

www.forumwebsite.com = 2a02:2658:1011:1::2:4
Location = www.forumwebsite.com

How would the lighttpd.conf would be like?

Regards,

Erawan Arif Nugroho

alsemany
02-24-2012, 09:35 PM
that's great .

I'm using kloxo , it have the option to switch from Apache to lighthttpd
however I like Apache because of the rewrite module

leadtech
02-27-2012, 09:12 AM
Thanks for sharing .. This tutorial works :)