FreeBSD Install Lighttpd Web Server
I’ve received couple of request about running Lighttpd web server under FreeBSD:
How do I install Lighttpd web server under FreeBSD along with MySQL 5 and PHP5?
lighttpd a secure, fast, compliant and very flexible web-server which has been optimized for high-performance environments. It has a very low memory footprint compared to other webservers and takes care of cpu-load. Its advanced feature-set (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) make lighttpd the perfect webserver-software for every server that is suffering load problems. Installing lighttpd is quite simple under FreeBSD operating system using ports.
Lighttpd on FreeBSD
First update your port tree by typing following commands:
# portsnap fetch
# portsnap update
Install lighttpd web server under FreeBSD
Lighttpd port is located under /usr/ports/www/lighttpd:
# cd /usr/ports/www/lighttpd
Install lighttpd:
# make
# make install
# make clean
Install MySQL server
Install MySQL server:
# cd /usr/ports/databases/mysql50-server/
# make
# make install
# make clean
Also install mysql client support
# /usr/ports/databases/mysql50-client
# make
# make install
# make clean
Finally install mysql scripts:
# cd /usr/ports/databases/mysql50-scripts
# make
# make install
# make clean
Install php5 for lighttpd
Install PHP5 scripting:
# cd /usr/ports/lang/php5
# make
# make install
# make clean
Next you must install PHP5 extensions such as GB, mysql support and so on. At least select following extensions from menu:
- ctype: The ctype shared extension for php
- curl: The curl shared extension for php
- dom: The dom shared extension for php
- gd: The gd shared extension for php
- imap: The imap shared extension for php
- mbstring: The mbstring shared extension for php
- mcrypt: The mcrypt shared extension for php
- mysql: The mysql shared extension for php
- mysqli: The mysqli shared extension for php
- pcre: The pcre shared extension for php
- posix: The posix shared extension for php
- session: The session shared extension for php
- simplexml: The simplexml shared extension for php
- xml: The xml shared extension for php
- xmlreader: The xmlreader shared extension for php
- xmlwriter: The xmlwriter shared extension for php
- zlib: The zlib shared extension for php
Type the following command:
# cd /usr/ports/lang/php5-extensions
# make
# make install
# make clean
Auto start lighttpd and mysql service
You need to enable both services. Open /etc/rc.conf:
# vi /etc/rc.conf
Append following two lines:
mysql_enable="YES"
lighttpd_enable="YES"
Start Mysql Server Under FreeBSD
To start MySQL server, enter:
# /usr/local/etc/rc.d/mysql-server start
Start Lighttpd Server Under FreeBSD
To start Lighttpd server, enter:
# /usr/local/etc/rc.d/lighttpd start
Verify that lighttpd is running:
# netstat -nat
FreeBSD Lighttpd configuration file location
- Config file location: /usr/local/etc/lighttpd.conf
- Default documentation root location : /usr/local/www/data/
- Default username and groupname : www
See also:
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in other helpful articles:
- How to upgrade lighttpd tar ball (source code) installation
- Download of the day: Lighttpd web server 1.4.17
- Lighttpd / Apache : Run Xcache in Chrooted Jail
- nixCraft FAQ Roundup ~ July, 3, 2007
- Turbo charge lighttpd with Linux AIO - Gain more performance
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: advanced_feature, php5, web_servers


Recent Comments
Yesterday ~ 4 Comments
Yesterday ~ 12 Comments
Yesterday ~ 6 Comments
Yesterday ~ 21 Comments
Yesterday ~ 1 Comment