Skip to content

Instantly share code, notes, and snippets.

@Rokt33r
Created April 28, 2015 07:35
Show Gist options
  • Save Rokt33r/6d60366da8e912d67e8d to your computer and use it in GitHub Desktop.
Save Rokt33r/6d60366da8e912d67e8d to your computer and use it in GitHub Desktop.
AWS Ubuntu setup for Laravel

AWS Ubuntu Setup

Overview

  • php5.6(php-fpm) for Laravel
  • nginx

1. Install Packages

sudo apt-get update && sudo apt-get install python-software-properties

sudo service apache2 stop
sudo apt-get install nginx

sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install php5 php5-fpm php5-mcrypt php5-mysql git
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Configure Nginx

vi /etc/nginx/sites-available/default
server {
    listen 80;
    server_name $APP_URL$;
    root /home/ubuntu/$APP_DIR$/public;

    server_tokens off;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/codexen.dev-error.log error;

    error_page 404 /index.php;

    sendfile off;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment