digital ocean nginx 🏴‍☠️

ติดตั้ง Laravel 5 ร่วมกับ MAMP บน OSX

install MAMP

*I was able to disable the Apache server that ships with OSX using the following command:

sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist

Find out where your PHP executable is located:
which php

Check this is the most recent version and under /Applications/MAMP
Add this path to ~/.bash_profile

sudo nano ~/.bash_profile

export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH

source ~/.bash_profile

curl -s | php

php composer.phar

sudo mv composer.phar /usr/bin/

sudo nano ~/.bash_profile

alias composer="php /usr/bin/composer.phar"

cd /Applications/MAMP/htdocs

composer create-project laravel/laravel your-project-name –prefer-dist

sudo chmod -R 775 your-project-name/storage
* Laravel 5

sudo chmod -R 775 your-project-name/app/storage
* Laravel < 5


digital ocean nginx Ubuntu 🏴‍☠️

ติดตั้ง Laravel 5 กับ Nginx บน Ubuntu 14.04

sudo apt-get update
sudo apt-get install nginx php5-fpm php5-cli php5-mcrypt git

sudo nano /etc/php5/fpm/php.ini
uncomment this and set

sudo php5enmod mcrypt

sudo service php5-fpm restart

sudo mkdir -p /var/www/laravel

sudo nano /etc/nginx/sites-available/default

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /var/www/laravel/public;
index index.php index.html index.htm;

server_name server_domain_or_IP;

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

location ~ .php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

sudo service nginx restart

Create Swap File (Optional) (like a 512mb Droplet).

First, we can create an empty 1GB file by typing:

sudo fallocate -l 1G /swapfile
We can format it as swap space by typing:

sudo mkswap /swapfile
Finally, we can enable this space so that the kernel begins to use it by typing:

sudo swapon /swapfile

Install Composer and Laravel

cd ~
curl -sS | php

sudo mv composer.phar /usr/local/bin/composer

sudo composer create-project laravel/laravel /var/www/laravel

sudo chown -R :www-data /var/www/laravel

sudo chmod -R 775 /var/www/laravel/storage
* Laravel 5

sudo chmod -R 775 /var/www/laravel/app/storage
* Laravel < 5


ref :