Skip to content

Instantly share code, notes, and snippets.

@adamcrampton
Created April 9, 2019 23:56
Show Gist options
  • Save adamcrampton/71cd710550794f9630d33f2c675cc79c to your computer and use it in GitHub Desktop.
Save adamcrampton/71cd710550794f9630d33f2c675cc79c to your computer and use it in GitHub Desktop.
Nginx - sites-available Laravel 5.x vhost example file - Ubuntu 18.04 + PHP 7.2
server {
listen 80;
listen [::]:80 ipv6only=on;
# Log files for Debugging
access_log /var/log/nginx/laravel-access.log;
error_log /var/log/nginx/laravel-error.log;
# Webroot Directory for Laravel project
root /var/www/laravel/public;
index index.php index.html index.htm;
# Your Domain Name
server_name laravel.test www.laravel.test;
location / {
try_files $uri $uri/ /index.php?$is_args$args;
}
# PHP-FPM Configuration Nginx
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment