Skip to content
Feb 5 / kkrizka

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
/etc/init.d/lighttpd start
/etc/init.d/mysql start

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:

/etc/init.d/lighttpd restart

6 Comments

Leave a comment
  1. jorel314 / Oct 8 2009

    Thanks! Installation was painless using your instructions.

  2. Reader1 / May 12 2010

    Dude! Your blog is infected with some kind of fake-antivirus script.. Please fix it. And thanks for the tutorial 😉

  3. Karol Krizka / May 15 2010

    Yup, seems like a lot of GoDaddy hosted blocks got hit.

  4. rewrite / Jun 24 2010

    Right. That was quick and easy. I already had lighttpd, php and mysql installed. But I have to give it to you, this is the best and fastest tutorial I’ve seen. Most children nowadays have you toying with php’s .ini files and lighttpd .conf files, and don’t know what they’re doing, other than making things complicated and slow. But after I saw this, you should go around posting this everywhere. Good job.

  5. Jeremy / Feb 10 2011

    To get mine working (ubuntu 10.04), I had to edit /etc/lighttpd/lighttpd.conf and add
    “/phpmyadmin/” => “/usr/share/phpmyadmin/”
    to alias.url at the bottom of the config file, then “sudo /etc/init.d/lighttpd force-reload” and restart the server “sudo service lighttpd restart”

Trackbacks and Pingbacks

  1. phpmyadmin with lighttpd on ubuntu | redigital blog
Leave a comment