Skip to content

Instantly share code, notes, and snippets.

@markovic131
Created May 28, 2014 14:50
Show Gist options
  • Save markovic131/2b1c3cdbb5ed6e2986a7 to your computer and use it in GitHub Desktop.
Save markovic131/2b1c3cdbb5ed6e2986a7 to your computer and use it in GitHub Desktop.
Nginx configuration for Laravel 4 app
server {
listen 80;
server_name laravel.local;
access_log /var/log/nginx/laravel.local/access.log;
error_log /var/log/nginx/laravel.local/error.log;
rewrite_log on;
root /var/www/laravel.local/public;
index index.php;
#location ~* \.(png|jpg|jpeg|gif)$ {
#
# expires 30d;
# log_not_found off;
#
#}
#location ~* \.(js|css|ico)$ {
#
# expires 3h;
# log_not_found off;
#
#}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Laravel 4 template (see file below)
include /etc/nginx/templates/laravel4;
}
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~* \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
# Typical vars in here, nothing interesting.
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment