0

So I have a small server with Lighttpd and I have installed PhpMyAdmin on it.

This is the default configuration. The Computer is accessible from the Internet on Port 80.

How can I make phpMyAdmin to listen on another port other then 80 ?

Or how can I make it to listen only on a specific subdomain ?

# Alias for phpMyAdmin directory
alias.url += (
        "/phpmyadmin" => "/usr/share/phpmyadmin",
)

# Disallow access to libraries
$HTTP["url"] =~ "^/phpmyadmin/templates" {
    url.access-deny = ( "" )
}
$HTTP["url"] =~ "^/phpmyadmin/libraries" {
    url.access-deny = ( "" )
}
$HTTP["url"] =~ "^/phpmyadmin/setup/lib" {
    url.access-deny = ( "" )
}

# Limit access to setup script
$HTTP["url"] =~ "^/phpmyadmin/setup" {
        auth.backend = "htpasswd"
        auth.backend.htpasswd.userfile = "/etc/phpmyadmin/htpasswd.setup"
        auth.require = (
                "/" => (
                        "method" => "basic",
                        "realm" => "phpMyAdmin Setup",
                        "require" => "valid-user"
                )
        )
}

1 Answer 1

0

After phpmyadmin is installed in your linux server (based on linux server flavors,such as CentOS, Debian, etc.), use online editor to open your lighttpd.conf file and add url.rewrite rules as shown below:

$HTTP["host"] =~ "dev\.example\.net$" {
   server.document-root = "/home/webroot"

   url.rewrite = (
       "^/(.*)\.(.+)$" => "$0",
       "^/(phpMyAdmin)/?(.*)" => "$0",
       "^/(.+)/?$" => "/index.php/$1"
   )

   url.access-deny = ( "~", "xmlrpc.php")
   server.error-handler-404 = "/index.php"
   dir-listing.activate       = "disable"
}

Then cd to /home/webroot directory (or any web directory where the web root level directory will be used for DOM (Document Objective Model) to serve web files such as html, php, etc. Then add a symbolic link to phpmyadmin:

ln -s /usr/share/phpmyadmin phpMyAdmin

Then, verify the symbolic link by typing:

ls -lat

which will display

lrwxrwxrwx 1 root root 21 Jan 20 14:27 phpMyAdmin -> /usr/share/phpmyadmin

Restart lighttpd, then open http://dev.example.net/phpMyAdmin in your web browser (or lynx)

NOTES: Lighttpd url.rewrite rules may vary, depending on the type of website (such as wordpress, Laravel framework, etc.). This rewrite line

"^/(phpMyAdmin)/?(.*)" => "$0", 

is important.

This dev.example.net domain name is used for reference. Replace dev.example.net with your domain name.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .