Skip to content

Instantly share code, notes, and snippets.

@brianmcdo
Created May 1, 2014 20:59
Show Gist options
  • Save brianmcdo/2aa0181f7e3f1af4efdd to your computer and use it in GitHub Desktop.
Save brianmcdo/2aa0181f7e3f1af4efdd to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name example.com;
root /src/path/to/laravel/public;
charset utf-8;
location /
{
index index.php index.html;
add_header Access-Control-Allow-Origin *;
}
# Check if file exists
if (!-e $request_filename)
{
rewrite / /index.php last;
break;
}
location ~ \.php(.*)$
{
# Pass the PHP files to PHP FastCGI for processing
try_files $uri = 404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
fastcgi_index index.php;
}
# Deny Any Access to .htaccess Files That May Be Present (not usually in issue in Laravel)
# include /etc/nginx/includes/deny_htaccess;
location ~ /\.ht
{
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment