ติดตั้ง 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
cgi.fix_pathinfo=0

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 https://getcomposer.org/installer | 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

FINISH

ref :
https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04

http://gunoob.com/fix-laravel-show-blank-or-white-page/

(Visited 94 times, 1 visits today)
Spread the love