Skip to content

tbremer/LEMN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LEMN  LEMN

LEMN is Linux, NGINX, MySQL & Node

A basic Ubuntu 14.04 Vagrant set up with nginx, mysql and nodejs

##Requirements

##Setup

  • Clone this repository https://github.com/tbremer/LEMN.git
  • Run vagrant up inside the newly created directory (the first time you run vagrant it will need to fetch the virtual box image which is ~300mb so depending on your download speed this could take some time)
  • Vagrant will then use puppet and bash scripts to provision the base virtual box with our LEMN Stack.
  • Once vagrant box is up you can either navigate to your now working server by going to: http://localhost:8888 or modifying your /etc/hosts file and add mapping to your domain that is consistent with your server alias:
# FILE: /etc/hosts

# ADDED LEMN DOMAINS
127.0.0.1    local.example.com

Where in your /etc/nginx/sites-availble/example file you have: server_name local.example.com

Usage

Some basic information on interacting with the vagrant box:

Port Forwards

  • 8888 - nginx base
  • 8889 - mysql
    • User: root
    • Password: blank
    • Database: database

Installed Node Modules

nginx

Included is one ready server setup, if you add more you will have to provision LEMN again. vagrant provision while box is running.

We use nginx as a proxy so you can run multiple node apps within one virtual environment (similar to how one would run a production server).

#FILE: /etc/nginx/sites-available/example

server {
    listen          80;
    charset         utf-8;
    server_name     local.example.com
                    ~local.example.([0-9\.]+).xip.io   #for testing on mobile devices
                    example.com;

    root /var/www/example;
    access_log /var/www/example/logs/access.log;
    error_log  /var/www/example/logs/error.log;
    include global/global.conf;

    location / {
      proxy_pass http://127.0.0.1:3000/;
      proxy_redirect off;
    }
 }

Vagrant

Vagrant is very well documented but here are a few common commands:

  • vagrant up starts the virtual machine and provisions it
  • vagrant suspend will essentially put the machine to 'sleep' with vagrant resume waking it back up
  • vagrant halt attempts a graceful shutdown of the machine and will need to be brought back with vagrant up
  • vagrant ssh gives you shell access to the virtual machine
  • vagrant destroy removes all known information about this box (keeps your www folder).

Table of Contents By: DocToc && Markdown Preview By: StackEdit.io