You are reading

Installing phpMyAdmin for Lighttpd

Posted: April 26, 2009 | By: TJ | In Technology | No comments yet

To begin, you must have Lighttpd and MySQL already installed. Log in via SSH and run following from the command line:

$ apt-get install phpmyadmin

After the package manager installs phpMyAdmin, you must add an alias to the Lighttpd configuration. Open the lighttpd.conf file in /etc/lighttpd and add the following line:

alias.url += ( "/phpmyadmin" => "/usr/share/phpmyadmin/" )

Reload your new lighttpd configuration:

$ /etc/init.d/lighttpd force-reload

Now you can go to your domain or IP address with /phpmyadmin to access the phpMyAdmin interface. But it’s not a good idea to have the phpMyAdmin login page publicly available. Now we must password protect this directory. To do this, open the lighttpd.conf again and paste in the following:

$HTTP["url"] =~ "^/phpmyadmin/" {
auth.backend = "plain"
auth.debug = 2
auth.backend.plain.userfile = "/etc/lighttpd/.phpmyadmin"
auth.require = ( "/phpmyadmin/" =>
(
"method" => "basic",
"realm" => "Restricted Area: phpMyAdmin",
"require" => "user=admin"
)
)
}

You’ll see the auth.backend.plain.userfile is an include as we don’t want to muck up the lighttpd.conf with user credentials. So to finish, create the .phpmyadmin file in /etc/lighttpd/ and paste in the following:

admin:password

Keep in mind you’ll want to replace ‘password’ with a real password. If you find that you are not prompted for a user/password when accessing ../phpmyadmin, check to see if mod_auth has been enabled. This should be in the top of your lighttpd.conf file under the server.modules section. If you don’t see it, add it, and then run the following command to enable mod_auth:

$ lighty-enable-mod auth
$ /etc/init.d/lighttpd force-reload

Leave your comment



Copyright © 2010. All rights reserved.

This blog is powered by WordPress and proudly hosted by (mt) Media Temple.