mod_rewrite Apache LAMP on DigitalOcean

This did the work for me.

sudo nano /etc/apache2/sites-enabled/000-default.conf

Also edited the vhost with the following to enable .htaccess.

<Directory /var/www/html/public/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

ติดตั้ง 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 :