Skip to content

Instantly share code, notes, and snippets.

@albankora
Last active June 8, 2017 02:35
Show Gist options
  • Save albankora/53f6ca7c780f06783752 to your computer and use it in GitHub Desktop.
Save albankora/53f6ca7c780f06783752 to your computer and use it in GitHub Desktop.
LEMP install and Laravel config
#make a folder for your app
mkdir /var/www
mkdir /var/www/laravel
#nginx config for laravel app
server {
listen 80 default_server;
root /var/www/laravel/public/;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
#configuring PHP
nano /etc/php5/fpm/php.ini
#find and change
cgi.fix_pathinfo=0
#configuring fpm pool
nano /etc/php5/fpm/pool.d/www.conf
#change on the pool config
#127.0.0.1:9000 => /var/run/php5-fpm.sock
listen = /var/run/php5-fpm.sock
#restart servers to load configs
service php5-fpm restart
service nginx restart
#install composer
curl -sS https://getcomposer.org/installer | php
#install it globally
mv composer.phar /usr/local/bin/composer
#fix permision
chgrp -R www-data /var/www/laravel
chmod -R 775 /var/www/laravel/app/storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment