Free Nginx AMI (LEMP) – CentOS, Nginx, MySQL & PHP-FPM

Note: This Free Nginx AMI has been merged into Nginx’s official AMI.

This Amazon EC2 AMI includes the latest Amazon Linux (Centos), Nginx 1.0.15, MySQL 5.1 & PHP 5.4 (PHP-FPM) custom installed and tuned for stability and speed.

top stats - Nginx AMI
Screenshot of top stats. This free Nginx AMI is optimized and runs fast even on t1.micro.

To access my free Nginx AMI, go to…

v1.0.1 – 05/25/2013: Locked down root password with “sudo passwd -l root” as per Amazon’s advice.

Tags: ,

Free Nginx AMI (LEMP) – CentOS, Nginx, MySQL & PHP-FPM

12 Responses

  1. Hey Hayden,

    Messing around with learning AWS using their free tier. Came across your AMI, installed and have gotten access via SFTP and SSH. All groovy. Even got into MySQL and did some hardening there (once I subscribed to your list here and got the extra information that was revealed!)

    My question to you is I am unable to make changes to the nginx.conf file in order to set up a domain that I’m now pointing to the Elastic IP I’ve connected to the instance I’m running at AWS.

    Is there a setting somewhere I forgot to check or uncheck that will allow me to make changes to the nginx files?

    Thanks, in advance, for your time on this one.


    James Kirk May 10, 2013 at 12:57 am #
  2. Hi James,

    Thanks for your question. This will help me to create an FAQ in future.

    Did you already edit /usr/local/nginx/conf/nginx.conf using vi or nano ?

    …where you replace with your domain and also make sure you have the web files in /mnt/www/web01

    Out of the box even if you load the IP or AWS domain of the instance in a browser it will load index.php which includes php info.

    @hydnj May 10, 2013 at 1:07 am #
  3. Hi Hayden,

    Thank you so much for the AMI. I would like to install Magento on the instance. Everything is fine except that it needs pdo_mysql loaded. So I installed php-mysql by yum, but nothing changes for “php -m”. Wondering how can I load pdo_mysql. Thanks a lot!!


    Si May 11, 2013 at 3:51 pm #
    • For better performance PHP isn’t installed using yum package. It was compiled into the system. To install pdo MySQL you’ll need to recompile PHP with pdo. The same goes for Nginx. Use the “Contact” form from the top nav if you require further help.

      @hydnj May 11, 2013 at 3:59 pm #
  4. What username should I use to access the AMI the first time? Root is just throwing a Permission Denied (publickey), even though I’m using the keypair which was used to spin up the instance. (for example: ssh -v -i /path/to/pemfile root@instanceip)

    Bob May 29, 2013 at 8:09 pm #
  5. Disregard. Mixup with my pem files. Sorry for the spam.

    Bob May 30, 2013 at 2:26 am #
  6. Thanks for sharing the AMI Hayden. This has been very helpful for me and sure others too would benefit from it. I noticed that the template has word press demo built into it and when I accessed the homepage, it was really slow and the site was not even coming up completely either – broken images, no style sheets applied etc.. Do I need to do any tweaking to make it run faster and/or config something? Here is the link ->

    Anonymous June 5, 2013 at 1:39 am #
    • I’ll fix that in the next update, by removing wordpress completely. When I first launched the AMI I created a test EC2 instance and it seems the default wordpress install left in the directory is still trying to pull from that inactive IP. So you can just delete wordpress completely then reinstall. Or you can use PHPmyAdmin to edit the wp_options table and simply replace the two url options that are pointing to the old EC2.

      I took that EC2 offline because it costs about $20 per month just to run a demo.

      @hydnj June 5, 2013 at 1:50 am #
  7. Thanks for the quick reply and understand. I will reinstall it and see if that performance is any better.

    Anonymous June 5, 2013 at 1:54 am #
    • Note that its not a “performance” issue. Your EC2 is trying to load an IP that no longer exist = timeouts. Also, even if the original EC2 still existed, it would not work correctly because that IP was the IP of the EC2 I build then cloned to create the AMI image, but the IP should be “your” EC2’s IP instead.

      So going forward I will remove the WordPress install from the original Nginx image I created and then push the AMI update.

      @hydnj June 5, 2013 at 1:58 am #
  8. I am trying to login to MySQL with no luck. What is the password for MySQL?

    Sam June 5, 2013 at 5:12 am #

Leave a Reply