Currently I’m using FreeBSD to run Lusca Head proxy server. To monitor my server, I just install cacti because it could access through web browser with refresh in 5, 10 and 15 minutes depend our needs.
Due to cacti runs with php and cgi, I need to optimize my web server to load cgi and php faster than before. As web server, I just use Lighttpd web server. So how to configure PHP under Lighttpd?. For this purpose, I’m using;
- FreeBSD 8.1
proxy# uname -a
FreeBSD proxy.janus.com 8.1-RELEASE-p2 FreeBSD 8.1-RELEASE-p2 #0: Thu Feb 10 11:48:52 WIT 2011 root@proxy:/usr/obj/usr/src/sys/PROXY i386
- Lighttpd 1.4
proxy# pkg_info | grep lighttpd
lighttpd-1.4.26_3 A secure, fast, compliant, and very flexible Web Server
- FastCGI PHP 5.3.5
And then so how to configure php under Lighttpd?, PHP runs on a web server like lighttpd taking PHP code as its input and creating Web pages as output. FastCGI is a protocol for interfacing interactive programs with a web server. Lighttpd itself has mod_fastcgi to run php application.
With assuming that you have php installed , open lighttpd.conf file;
# ee /usr/local/etc/lighttpd.conf
Make sure FASTCGI module is enabled:
server
.modules += ( “mod_fastcgi” )
Now uncomment following code
fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/local/bin/php-cgi”
)
)
)
Save and close the file. Restart lighttpd:
# /usr/local/etc/rc.d/lighttpd restart
