Definitive "Must Do" For Wordpress LEMP Setup

September 16, 2014 1.7k views

As of about two weeks ago, I'm completely new to VPS, and came from shared hosting. I've learned quite a bit over the last few weeks, but I know there's plenty more to learn. My simple question, what are the "must do" actions for a Wordpress website running on a LEMP setup? Here's what I HAVE done:

-Installed LEMP
-Installed Wordpress (site is up and running now)
-Initial Security Setup (https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04)
-Created Sever Blocks for various websites
-Configured SSH login for wordpress (https://www.digitalocean.com/community/tutorials/how-to-configure-secure-updates-and-installations-in-wordpress-on-ubuntu)
-Configure SSH for Filezilla

That's the gist of what I've learned / done thus far. A few things that need mentioning in my case:

My Wordpress installation is at /var/www/anightinburlington.com/public_html/wordpress and the site is served at . I tried to get help on the server block php config, but nobody seemed to know how to set it up. I blindly guessed and came up with this, which is the ONLY setup that's worked thus far, but nobody has confirmed why / if this is right. Notice the root / try files setup:

root /var/www/anightinburlington.com/public_html;
    index index.php index.html index.htm;

    server_name anightinburlington.com www.anightinburlington.com;

    location / {
            # try_files $uri $uri/ =404;
            try_files $uri $uri/ /wordpress$uri/ /index.php?q=$uri&$args;

The other thing, is that when I try to install W3 Total Cache, it says it can't create directories, etc, etc, and everything I try seems to fail on that front (other plugins work fine, via SSH).

I've also looked into Memcache, but I'm not sure if that's right for me, as I'm on a $5 droplet setup, with only 512MB of RAM. Can anyone let me know if there's anything else I should do before I'm essentially good to go? Any information on my other questions would be great as well - many thanks!

1 comment
  • Not directly related to your question, but my 512MB with 512MB Swap can handle following load of mine

    Setup -> CentOS 6.5 x86 / zPanel / WordPress (running W3TC) / CopperMine

    Usually I serve around 3.5k unique with around 7k to 7.5k page views daily..

    Yes, htop and free -m always show really high load stats but since I didnt have a crash yet so I have not yet updated to 1GB Plan..

1 Answer

Hey Porter!

One thing I would recommend is to create a swap partition in your droplet. It can help with performance. This tutorial will get you covered: How To Add Swap on Ubuntu 14.04 .

Now, for Nginx's configuration, you will find a lot of information here, including how your vhost file should look like: How To Install WordPress with Nginx on Ubuntu 14.04 . Head to "Step 5" and you will find it.

Regarding the permission problems, theres some good information here: Correct permissions for Wordpress on LEMP.

As another suggestion, I always like to install fail2ban in my servers. It helps keeping it safe from brute-force login attempts.

by Justin Ellingwood
Swap space can be used as an "overflow" area for your system when you run out of RAM. The operating system can store data that would normally be kept in RAM on the hard drive in a specially formatted file. In this guide, we'll demonstrate how to create and use one of these files in Ubuntu 14.04.
  • Thanks for the info, Erika. I've actually learned quite a bit over the last few weeks (I'm horrible about asking a question, then waiting for an answer haha), but some of this is still new to me! I'll definitely look into fail2ban, as I don't currently have that. As for my nginx config, I'm a pro at that now - go me.

    My only remaining question is about the Swap, as I keep reading mixed information on if that's a good move on a 512MB droplet. I'll probably use 512 for quite some time, and will upgrade to a 1GB or higher once my projects take off. Is 512 fine for Swap, or should I wait? As per my nature, I'll also read up on it in the near future. Thanks for the info!

  • Hello again! :) Well, I can tell for personal experience that the swap helped a lot with memory issues in the 512MB droplets. I think the limitation would be more related to disk space. I used 1GB swap for my 512MB droplets and I was able to run Jira and Stash (Java applications) in the droplet - quite an achievement. I also had some memory problems with Composer once, and adding the swap fixed them (also in the 512MB droplet).

Have another answer? Share your knowledge.