Here is a quick start guide on how to get Magento 1 up and running quickly on Ubuntu 16.04, specifically for AWS EC2 – but should work for other hosts as well like Digital Ocean.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install nginx
sudo apt-get install mariadb-server mariadb-client
Next up, add the PHP 5.6 repository (as Magento 1 doesn’t yet support PHP 7).
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6 php5.6-fpm php5.6-mcrypt php5.6-gd php5.6-mysql php5.6-curl php5.6-xml
For some strange reason, I had Apache 2 running on my Ubuntu 16.04 which makes me wonder if it ships with it by default. Remove Apache 2:
sudo apt-get remove apache2*
The following is my default Nginx config for Ubuntu 16.04. The only difference between Ubuntu 14 and 16 is the .sock
file location. Save the following as /etc/nginx/sites-available/test.franciskim.co
(and obviously change the domain name to suit yours)
server {
listen 80;
server_name example.franciskim.co;
root /home/ubuntu/example.franciskim.co;
access_log /var/log/nginx/access.example.franciskim.co.log;
error_log /var/log/nginx/error.example.franciskim.co.log;
client_max_body_size 8M;
index index.html index.php;
## SSL CONFIGURATION (If needed)
#ssl_certificate /etc/nginx/ssl/example.franciskim.co.crt;
#ssl_certificate_key /etc/nginx/ssl/example.franciskim.co.key;
location = /js/index.php/x.js {
rewrite ^(.*\.php)/ $1 last;
}
## Main Magento @location
location / {
try_files $uri $uri/ @rewrite;
}
## Server maintenance block
#include /etc/nginx/conf.d/maintenance.conf;
## Error log/page
#include /etc/nginx/conf.d/error_page.conf;
## These locations are protected
location ~ /(app|var|downloader|includes|pkginfo)/ {
deny all;
}
## Images
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
add_header ETag "";
}
location @rewrite {
rewrite / /index.php;
}
## Execute PHP scripts
location ~ \.php$ {
try_files $uri =404;
fastcgi_read_timeout 1200;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
## Store code if you have a multi-domain Magento setup
#fastcgi_param MAGE_RUN_CODE $mage_code;
#fastcgi_param MAGE_RUN_TYPE $mage_type;
include fastcgi_params;
}
}
Then as per best-practice, alias the file to the /etc/nginx/sites-enabled
directory:
sudo ln -s /etc/nginx/sites-available/example.franciskim.co /etc/nginx/sites-enabled/example.franciskim.co
Next few steps are:
- Place your Magento files in
/home/ubuntu/example.franciskim.co/
- Create the database in MySQL / MariaDB
- If you have an existing site, import the MySQL database and configure
app/etc/local.xml
otherwise run through the installer
From time to time throughout this guide, you will need to restart your services:
sudo service nginx restart && sudo service php5.6-fpm restart
sudo service mysql restart
Good luck! Leave any questions in the comments.
The post Magento 1 Quick Start: LEMP Stack Ubuntu 16.04 (AWS EC2) appeared first on Francis Kim.