Setting up a Debian LLMP server

LLMP, Debian, lighttpd, xcache,… what is all that?

While most of you might know a LAMP server (Linux, Apache, MySQL, PHP), little know a LLMP or LEMP server.
The only difference between them is the software that is used to serve your webpages.
LAMP uses Apache, LEMP uses Nginx and LLMP uses Lighttpd.

There are also other differences that come as a result of not choosing Apache. Apache has a mod_php to use php. This comes down to a sandboxed environment for using PHP, but also for each child process that has to be created, a fully loaded PHP module has to be loaded. This is very memory consuming. Lighttpd and Nginx only serve webpages and let PHP run as a separate service, much like MySQL is also a separate service.

If you are interested in a memory and request per second comparison of these web-servers, you can go and take a look at here. Dreamhost has done a nice review about this.

Last but not least XCache. This is an optcache. Optcaches are used to speed everything up. When a php file is requested, php first compiles this page, then runs the compiled code, sends the results to the webserver to finally send it to the machine that requested it. This compilation takes ‘a lot’ of time and has to be done every time a file is requested. An optcache will save the compiled version of the php file as long as the original php file is not changed. This will decrease the server load and increase responsiveness of the website. Also you can save variables in XCache (like a global variable for the people that know this). Only you can save over 100.000 values without decreasing performance. This can be used to decrease load on the database server.

Installing everything…

First you have to be certain that you don’t break anything by installing this. This means that no other web-servers are running, no MySQL or MariaDB is installed, etc…

I’m also assuming you are running as root, an internet connection is available and you know your way around with nano and other default tools.

Installing Lighttpd

#apt-get install lighttpd

And that is it. You can now browse to the IP address of the linux box and you should see your first ‘welcome webpage’.
You might want to change certain options like port number (default 80) or document path (default /var/www). This can be done in “/etc/lighttpd/lighttpd.conf”.

Installing PHP

We don’t only want to serve static content, so we will also install PHP.

#apt-get install php5-cgi

Next, we want to enable lighttpd to use PHP. This is done by the following commands.

#lighttpd-enable-mod fastcgi
#lighttpd-enable-mod fastcgi-php
#service lighttpd force-reload

Installing MySQL

#apt-get install mysql-server

Next we should want to secure the database server a bit. This easy by running the following command.


The most used way to administrate a mysql database on a LLMP, LAMP or LEMP server is by using PhpMyAdmin. You can install this with the following command.

#apt-get install phpmyadmin

During the install you can automatically push the settings to Lighttpd. Afterwards i would recommend doing an extra service lighttpd force-reload to ensure all configurations are loaded correctly.
If you need to restart lighttpd to reflect the changes by running

#service lighttpd restart

Installing xCache

#apt-get install php5-xcache

We might also want to see the statistics of xcache. This is done by the following command (assuming your directory with your webcontent is /var/www)

#cp -a /usr/share/xcache/admin /var/www/xcache-admin

Next we navigate to http://IP/mkpassword.php and enter a password in the box and click submit. You will get a MD5 of your password. This we need to enter in the config file of XCache.

#nano /etc/php5/conf.d/20-xcache.ini

Here we remove the ; before xcache.admin.user and xcache.admin.pass and change the user if needed (i recommend this) and we change the pass to the MD5 value we generated before.

Next we need to restart lighttpd to reflect the changes by running service lighttpd restart .

And now you have a fully functional LLMP server with Xcache support enabled.

Original link:


您的电子邮箱地址不会被公开。 必填项已用 * 标注