lighttpd forum migration > Need Guide For Centos

Posted by Gemil Gonrad
on 03.05.2006 23:37
Hi,

I was wondering if there are any good guides out there on how to install
lighttpd, php, mysql and eaccelerator with yum or any other easy way.
Basicly I am a lighty noob, all help is much appriciated. Thank you.
Posted by Pete Lavetsky
on 05.05.2006 13:05
Gemil Gonrad wrote:
> Hi,
> 
> I was wondering if there are any good guides out there on how to install
> lighttpd, php, mysql and eaccelerator with yum or any other easy way.
> Basicly I am a lighty noob, all help is much appriciated. Thank you.

Take a look at http://trac.lighttpd.net/trac/wiki/TutorialInstallation

Pete
Posted by Gemil Gonrad
on 05.05.2006 23:07
Pete Lavetsky wrote:
> Gemil Gonrad wrote:
>> Hi,
>> 
>> I was wondering if there are any good guides out there on how to install
>> lighttpd, php, mysql and eaccelerator with yum or any other easy way.
>> Basicly I am a lighty noob, all help is much appriciated. Thank you.
> 
> Take a look at http://trac.lighttpd.net/trac/wiki/TutorialInstallation
> 
> Pete

Sorry for asking but what package do I need to look for? Do I need a rpm 
or just a archive, if so which one?
Posted by Pete Lavetsky
on 06.05.2006 00:22
Gemil Gonrad wrote:
> Pete Lavetsky wrote:
>> Gemil Gonrad wrote:
>>> Hi,
>>> 
>>> I was wondering if there are any good guides out there on how to install
>>> lighttpd, php, mysql and eaccelerator with yum or any other easy way.
>>> Basicly I am a lighty noob, all help is much appriciated. Thank you.
>> 
>> Take a look at http://trac.lighttpd.net/trac/wiki/TutorialInstallation
>> 
>> Pete
> 
> Sorry for asking but what package do I need to look for? Do I need a rpm 
> or just a archive, if so which one?

More specifics please ... I'm not familiar with CentOS ... did you look 
at that link? It references the packages you'll need for lighty to work.

Pete
Posted by Gemil Gonrad
on 06.05.2006 02:39
Pete Lavetsky wrote:
> Gemil Gonrad wrote:
>> Pete Lavetsky wrote:
>>> Gemil Gonrad wrote:
>>>> Hi,
>>>> 
>>>> I was wondering if there are any good guides out there on how to install
>>>> lighttpd, php, mysql and eaccelerator with yum or any other easy way.
>>>> Basicly I am a lighty noob, all help is much appriciated. Thank you.
>>> 
>>> Take a look at http://trac.lighttpd.net/trac/wiki/TutorialInstallation
>>> 
>>> Pete
>> 
>> Sorry for asking but what package do I need to look for? Do I need a rpm 
>> or just a archive, if so which one?
> 
> More specifics please ... I'm not familiar with CentOS ... did you look 
> at that link? It references the packages you'll need for lighty to work.
> 
> Pete

I think I need a solid repo for this to work. I've managed to run lighty 
but and installed php with cgi, but when Im calling anypage.php the 
sourcefile just gets downloaded. php -v returns (cgi). Any suggestions?
Posted by Gemil Gonrad
on 06.05.2006 11:17
I've managed to install lighttpd + php with cgi support, but when
calling a php script I receive "internal server error 500". I really
need this server to work because I have a very large site with many hits
and apache simply wont do it.

BTW, Im running on centos 4.3 with a Athlon 64 X2 3800+ Dual Core 
procesor

My error log provides:

[log]
2006-05-08 01:07:35: (mod_fastcgi.c.1739) connect failed: Connection
refused on unix:/tmp/php-fastcgi.socket-0
2006-05-08 01:07:35: (mod_fastcgi.c.2851) backend died, we disable it
for a 5 seconds and send the request to another backend instead:
reconnects: 0 load: 4
2006-05-08 01:07:42: (mod_fastcgi.c.2430) unexpected end-of-file
(perhaps the fastcgi process died): pid: 26865 socket:
unix:/tmp/php-fastcgi.socket-0
2006-05-08 01:07:42: (mod_fastcgi.c.3168) child exited, pid: 26865
status: 0
2006-05-08 01:07:42: (mod_fastcgi.c.3215) response not received, request
sent: 860 on socket: unix:/tmp/php-fastcgi.socket-0 for /clam.php ,
closing connection
[/log]

php -v returns:

PHP 4.3.9 (cgi) (built: Apr 25 2006 09:39:58)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies


and finaly my lighttpd.conf file:

# lighttpd configuration file
#
# use a it as base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $

############ Options you really have to take care of
####################

## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules              = (
                               "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
                               "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = "/srv/www/lighttpd/"

## where to send error-messages to
server.errorlog             = "/var/log/lighttpd/error_log"

# files to check for if .../ is requested
server.indexfiles           = ( "index.php", "index.html",
                                "index.htm", "default.htm" )

# mimetype mapping
mimetype.assign             = (
  ".rpm"          =>      "application/x-rpm",
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
 )

# Use the "Content-Type" extended attribute to obtain mime type if
possible
#mimetype.use-xattr        = "enable"


## send a different Server: header
## be nice and keep it at lighttpd
#server.tag                 = "lighttpd"

#### accesslog module
accesslog.filename          = "/var/log/lighttpd/access_log"

## deny access the file-extensions
#
# ~    is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be
part
#      of the document-root
url.access-deny             = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

######### Options that are good to be but not neccesary to be changed
#######

## bind to port (default: 80)
#server.port                = 81

## bind to localhost (default: all interfaces)
#server.bind                = "grisu.home.kneschke.de"

## error-handler for status 404
#server.error-handler-404   = "/error-handler.html"
#server.error-handler-404   = "/error-handler.php"

## to help the rc.scripts
server.pid-file             = "/var/run/lighttpd.pid"


###### virtual hosts
##
##  If you want name-based virtual hosting add the next three settings
and load
##  mod_simple_vhost
##
## document-root =
##   virtual-server-root + virtual-server-default-host +
virtual-server-docroot
## or
##   virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root   = "/home/weigon/wwwroot/servers/"
#simple-vhost.default-host  = "grisu.home.kneschke.de"
#simple-vhost.document-root = "/pages/"


##
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix    =
"/home/weigon/projects/lighttpd/doc/status-"

## virtual directory listings
#server.dir-listing         = "enable"

## enable debugging
#debug.log-request-header   = "enable"
#debug.log-response-header  = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found   = "enable"

### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot              = "/"

## change uid to <uid> (default: don't care)
server.username             = "lighttpd"

## change uid to <uid> (default: don't care)
server.groupname            = "lighttpd"

#### compress module
#compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
#compress.filetype          = ("text/plain", "text/html")

#### proxy module
## read proxy.txt for more info
#proxy.server               = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "host" => "192.168.0.101",
#                                   "port" => 80
#                                 )
#                               )
#                             )

#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" =>
"/tmp/php-fastcgi.socket",
                                   "bin-path" => "/usr/bin/php"
                                 )
                               )
                            )

#### CGI module
#cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
#                               ".cgi" => "/usr/bin/perl" )
#

#### SSL engine
#ssl.engine                 = "enable"
#ssl.pemfile                = "server.pem"

#### status module
#status.status-url          = "/server-status"
#status.config-url          = "/server-config"

#### auth module
## read authentication.txt for more info
#auth.backend               = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"

#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
#auth.backend.ldap.filter   = "(uid=$)"

#auth.require               = ( "/server-status" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "download archiv",
#                                 "require" => "user=jan"
#                               ),
#                               "/server-info" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "download archiv",
#                                 "require" => "valid-user"
#                               )
#                             )

#### url handling modules (rewrite, redirect, access)
#url.rewrite                = ( "^/$"             => "/server-status" )
#url.redirect               = ( "^/wishlist/(.+)" =>
"http://www.123.org/$1" )

#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern        = "/home/storage/dev/www/%3/htdocs/"

#### expire module
#expire.url                 = ( "/buggy/" => "access 2 hours",
"/asdhas/" => "access plus 1 seconds 2 minutes")

#### ssi
#ssi.extension              = ( ".shtml" )

#### rrdtool
#rrdtool.binary             = "/usr/bin/rrdtool"
#rrdtool.db-name            = "/var/www/lighttpd.rrd"

#### setenv
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )

## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename =
"/home/weigon/testbase/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10

## for mod_cml
## don't forget to add index.cml to server.indexfiles
# cml.extension               = ".cml"
# cml.memcache-hosts          = ( "127.0.0.1:11211" )
Posted by Gemil Gonrad
on 07.05.2006 12:12
Never mind I figured out what I was doing wrong. First I needed lighttpd 
with fastcgi (dag and centos repo's). After configuring the repo file I 
installed lighttpd lighttpd-fastcgi. When that install was complete I 
installed php5. To check my php install: php-cgi -v, which returned:

PHP 5.0.4 (cgi-fcgi) (built: Nov 30 2005 14:44:03)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies

After that I simply uncommented the fcgi module in lighttpd.conf and 
changed the path to php-cgi.

When trying to load any.php I still had a weird error, instead of 
returning html the server downloaded the php file. So I tried <php in my 
test file and requested the page again: Voila it worked.
Posted by Nathan Davies
on 16.05.2006 16:37
CentOS is nothing more than RedHat recompiled. Installation should be 
the same on RedHat/Fedora/CentOS
Posted by Email Site
on 04.07.2007 11:11
Nathan Davies wrote:
> CentOS is nothing more than RedHat recompiled. Installation should be 
> the same on RedHat/Fedora/CentOS

I also have the same type of problem you'd had with installing Lighttpd 
on CentOS that have support for running PHP scripts.

If I type php -v it returns somethink like: PHP 4.3.9 (cgi).
So everytime I want to start lighttpd with fastcgi support it's 
automatically turned off (the server doesn't start anymore).

Could you please help me in installing Lighttpd with support for PHP 
scripts on CentOS?

Thank you for all these matters. I am looking forward to receiving an 
answer from you.
Posted by Anthony Ferrara
on 06.07.2007 17:58
You need to compile php with FastCGI support (--enable-fastcgi).
Posted by Email Site
on 07.07.2007 11:45
Anthony Ferrara wrote:
> You need to compile php with FastCGI support (--enable-fastcgi).


After compiling PHP 5 with --enable-fastcgi and installing 
lighttpd-fastcgi I have configured it to bind on port 81. When I try to 
start the server it gives me the following error:

[root@ bin]# lighttpd -f /etc/lighttpd/lighttpd.conf start
2007-07-07 13:31:58: (mod_fastcgi.c.899) bind failed for: 
unix:/tmp/php-fastcgi.socket-0 Address already in use
2007-07-07 13:31:58: (mod_fastcgi.c.1333) [ERROR]: spawning fcgi failed.
2007-07-07 13:31:58: (server.c.849) Configuration of plugins failed. 
Going down.
Posted by Jan Scholten
on 07.07.2007 13:25
Email Site wrote:
> Anthony Ferrara wrote:
>> You need to compile php with FastCGI support (--enable-fastcgi).
> 
> 
> After compiling PHP 5 with --enable-fastcgi and installing 
> lighttpd-fastcgi I have configured it to bind on port 81. When I try to 
> start the server it gives me the following error:
> 
> [root@ bin]# lighttpd -f /etc/lighttpd/lighttpd.conf start
> 2007-07-07 13:31:58: (mod_fastcgi.c.899) bind failed for: 
> unix:/tmp/php-fastcgi.socket-0 Address already in use
> 2007-07-07 13:31:58: (mod_fastcgi.c.1333) [ERROR]: spawning fcgi failed.
> 2007-07-07 13:31:58: (server.c.849) Configuration of plugins failed. 
> Going down.

No need to post in two subforums there is obviously a php running (ps 
-axw?) or the socket has not been removed.. kill the porocess specify 
another socket or remove the socket.
Posted by Guest (Guest)
on 17.01.2008 12:44
Jan Scholten wrote:
> Email Site wrote:
>> Anthony Ferrara wrote:
>>> You need to compile php with FastCGI support (--enable-fastcgi).
>> 
>> 
>> After compiling PHP 5 with --enable-fastcgi and installing 
>> lighttpd-fastcgi I have configured it to bind on port 81. When I try to 
>> start the server it gives me the following error:
>> 
>> [root@ bin]# lighttpd -f /etc/lighttpd/lighttpd.conf start
>> 2007-07-07 13:31:58: (mod_fastcgi.c.899) bind failed for: 
>> unix:/tmp/php-fastcgi.socket-0 Address already in use
>> 2007-07-07 13:31:58: (mod_fastcgi.c.1333) [ERROR]: spawning fcgi failed.
>> 2007-07-07 13:31:58: (server.c.849) Configuration of plugins failed. 
>> Going down.
> 
> No need to post in two subforums there is obviously a php running (ps 
> -axw?) or the socket has not been removed.. kill the porocess specify 
> another socket or remove the socket.



From where you find lighttpd-fastcgi package i am looking on the net but 
found nothing.