0 Liked

    LNMP+Memcache+eAccelerator on Debian6

    I recently rebuild my linux image on Linode, so I have to reinstall the LEMP stack again from ground. Last time was probably more than a year ago, with the help of many tutorials from google. So this time I decide to write what I did step by step for my reference in the future.

    I am using Debian 6 32bit with linux kernel 3.0.4. After first log in to your debian, first you want to add Dotdeb repository to the system repository list. Dotdeb is a repository containing packages of stable and latest LAMP or LEMP servers and their many useful extensions. To add that

    Add following two lines to the bottom of the file

    And then fetch the appropriate GnuPG key

    After that run

    Now we are ready to install the LEMP stack packages.

    1. Nginx
    Since the dotdeb repository we just added already have the latest stable version of nginx 1.0.6, we don’t have to compile it from the official source, just run

    That’s it. The default location for the conf files is /etc/nginx/ and there will be a init.d script /etc/init.d/nginx to start and stop nginx.
    We would want nginx start each time the system boots, run the command

    2. PHP with FPM
    PHP-FPM (PHP FastCGI Process Management) is a patch for PHP to improve PHP’s FastCGI capabilities and administration. It has been bundled with PHP since the PHP 5.3.3 so we don’t need to install it besides the PHP5

    This only php5 with fpm, I need to add some more php extensions

    Next to start nginx and php5-fpm if they are not already started.

    Following is to configure nginx to redirect all php request to php-fpm to process

    The default www directory of nginx is /etc/share/nginx/www, if you still want it there, no need to change anything. I changed the directory to /var/www so I have to create them.

    My version looks like below

    Note: I use this conf file only for the ip access to the site, not combined with any domain. I will create other conf file for each site later.

    Now if you create a simple php file index.php in directory /var/www/default

    When you visit the ip address of your server you should be able to see the phpinfo page.

    This one is easy, just run


    For the configuration of those applications, I will create new posts for each one with detailed information.

    For this one, we are gonna have to install it from the official source file. The current latest version is Before compiling, you have to install php5-dev

    We are downloading from Sourceforge, the link is

    Run following commands:

    If every command goes through without errors, the eaccelerator module should be installed, but it’s not in use yet. We have to configure php.ini to include the module.
    Usually there are multiple php.ini files, to see which file is in use right now you can see the phpinfo page just created or in the command line:

    If you follow the steps above, it should in /etc/php5/fpm/php.ini, add following code to the end of php.ini

    Then restart php-fpm

    Now go to you phpinfo page, if it looks like below, then you have the eaccelerator module in work.

    If you want to view the status of the eaccelerator and control it through web,

    The default username is admin, password is eAccelerator. Please change the password in the control.php file!

    Till here you have accomplished the basic set up of a LEMP server on Debian 6. However there are still configuration and optimization steps to go. These steps will be different for different machines, systems and environment.

    Leave a Reply

    18 − 3 =

    This site uses Akismet to reduce spam. Learn how your comment data is processed.