LAMP to LEMP Conversion in Linode

I am at present using LAMP stack in Linode and running 2 websites. I want to use Nginx server instead of Apache. Do I need to buy a new linode account and setup server from the very beginning. Or is there any shortcut method to achieve this?

What is the best possible way for such conversion from LAMP to LEMP?

6 Replies

The best possible way? It all depends on your distro, your control panel software, etc.

You can:

  • install Nginx from the command line.

  • configure Nginx to use a port other than port 80 (a temporary measure).

  • set up your vhost files for your websites using Nginx

  • test your websites using the Nginx port.

Once you're confident that everything is working as desired you can:

  • stop the Nginx service.

  • change the Nginx configuration to use port 80.

  • stop the Apache service (and make sure it doesn't automatically restart when your Linode reboots).

  • start the Nginx service (and make sure it automatically starts when your Linode reboots).

Thanks Main Street James.
@Main Street James:

The best possible way? It all depends on your distro, your control panel software, etc.

2GB unmanaged linode vps account here. Hosted two websites in LAMP environment following this guide:

So, it appears that I can safely jump towards the conversion from LAMPP to LEMP. All I need is to follow: … e-pangolin">

and after successful working of sites in Nginx, I can uninstall Apache.

What additional step I have to take to make sure apache doesn't automatically restart when Linode reboots?


aicbal, if you are going to uninstall Apache then you don't need to do anything else to make sure it doesn't run ever again. If you want to stop Apache from running automatically but aren't going to uninstall it, here's what you can do:

For Debain based distros (eg, Ubuntu, Linux Mint, etc):

update-rc.d -f apache2 remove

For Red Hat based distros (eg, Fedora, CentOS, etc):

# chkconfig httpd off
# chkconfig httpd --del

Thanks Main Street James for your reply.

Please confirm whether the following steps are OK if I like to shift into LEMP environment completely.

1. Uninstall Apache using command: apt-get –purge remove apache2.

2. Install Nginx using command: apt-get install nginx.

3. Configure Nginx virtual hosting to use port 80.

4. Install PHP-FPM using command: apt-get install php5-fpm.

5. Configure PHP.

6. No need to configure MySQL as it is already installed and configured.

Do you agree with the above steps?

If it is alright, then, I shall try it tomorrow.

aicbal, just in case you run into a problem I would not uninstall Apache until you are absolutely sure that Nginx is working properly. But you may do as you wish.

Honestly it is going to be a lot cleaner to just setup a new LEMP server and migrate your needed files over to the new VPS.

If you try to install multiple stacks it will get messy really fast and lead to possible security or stability problems.

Just setup a new LEMP stack and move your files, and delete the old server when you are sure its fine. For example if you have a Wordpress site on LAMP Apache just move your web design files (and database dump) to the LEMP server and that's all.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct