Skip to content

Instantly share code, notes, and snippets.

@crushcafeteria
Created June 29, 2017 08:16
Show Gist options
  • Save crushcafeteria/3bcf0afa8f6e6042ef491643d9c93ba5 to your computer and use it in GitHub Desktop.
Save crushcafeteria/3bcf0afa8f6e6042ef491643d9c93ba5 to your computer and use it in GitHub Desktop.
Sample Nginx Laravel Server Block
server {
listen 80 default_server;
root /var/www/laravel/public;
index index.php index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php = 404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
  1. mkdir /var/www/laravel
  2. vim /etc/nginx/sites-available/default #replace default with https://gist.github.com/dikaio/601ec9b09b5a282db8b78ab89f1ad92b
  3. vim /etc/php/7.0/fpm/php.ini #change cgi.fix_pathinfo=1 with 0=
  4. vim /etc/php/7.0/fpm/pool.d/www.conf #change line, listen = 127.0.0.1:9000 to listen = /run/php/php7.0-fpm.sock
  5. sudo service php7.0-fpm restart && sudo service nginx restart
  6. curl -sS https://getcomposer.org/installer | php
  7. mv composer.phar /usr/local/bin/composer
  8. composer create-project laravel/laravel /var/www/laravel/ 4.2
  9. 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