| How To Configure Lighttpd With PHP And MySQL Support On CentOS 6 |
|
|
|
| How To - Lighttpd | |
| Written by Christian Foronda | |
| Wednesday, 20 July 2011 13:30 | |
|
This tutorial is tested on a bare installation of CentOS 6. Install wget: # yum install wget
Install RPMforge repository: # wget -c http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm # rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Temporarily disable SELinux: # echo 0 > /selinux/enforce
Add port 80 on iptables: Default rules: # iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
# iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT # iptables-save > /etc/sysconfig/iptables
Note: All rules should be input above any reject rules.
# iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
Install Lighttpd: # yum install lighttpd
Install FastCGI and MySQL support: # yum install lighttpd-fastcgi php-cli php-mysql
Enable FastCGI: # vi /etc/lighttpd/modules.conf
Uncomment the line 132: include "conf.d/fastcgi.conf"
Configure FastCGI: # mkdir /var/run/lighttpd # chown lighttpd.lighttpd /var/run/lighttpd # vi /etc/lighttpd/conf.d/fastcgi.conf
At the end of the file, append the following: fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi",
"max-procs" => 5,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "10000" ),
"broken-scriptfilename" => "enable"
)
)
)
Start lighttpd: # /etc/init.d/lighttpd start
Add lighttpd to your startup: # chkconfig --add lighttpd
Test configuration: # echo "<?php phpinfo(); ?>" > /srv/www/lighttpd/info.php
Open to your browser and go to: http://ServerIPAdd/info.php
You should see a page with your PHP information.
Similar articles
|
|
| Last Updated on Wednesday, 20 July 2011 14:27 |



