How To Quickly Install LigHTTPD, MySQL and PHP5 On Ubuntu
There is nothing better for web development that having your own local web server to test your web pages on before uploading them to a live server. As a Linux user, I have many choices including Apache2 and Lighttpd. I chose to use the latter of the two, because it is more lightweight and I do not need any of the fancy features offered by Apache2. Of course, a good web server is not the only application a web developer needs. a MySQL database and PHP5 support are almost always required. This whole setup is usually referred to as LLMP (Linux, Lighttpd, MySQL, PHP) and there is already an excellent tutorial that guides one through installation on Ubuntu. However it includes too much detail, and many people (including me) that already know what they need, and just want to know the commands to install everything. So I decided to compress the tutorial into one short blog post.
Execute the following commands as root (access can be gained through sudo /bin/bash)
aptitude install lighttpd mysql-client mysql-server php5-mysql php5-cgi phpmyadmin
lighty-enable-mod fastcgi userdir
That is it, you now have a fully functional web development environment (well, not including the editor) right on your Ubuntu installation. You can access your webpage through http://localhost or http://localhost/~user for contents of user‘s public_html file. Also phpMyAdmin, a great web based manger for MySQL databases is accessible through http://localhost/phpmyadmin
Another useful thing is to enable access to your web server only from your own computer. To do this, open the /etc/lighttpd/lighttpd.conf file using the following command:
sudo gedit /etc/lighttpd/lighttpd.conf
And uncomment the line that says:
server.bind = "localhost"
You uncomment the line by removing the # symbol that is at the beginning of it. After you are done, the line should look like above. Make sure to restart the lighttpd server for the changes to take effect using the following command: