Skip to content

Instantly share code, notes, and snippets.

Created October 18, 2015 16:18
Show Gist options
  • Save anonymous/f0fa2842afb7b3c2a085 to your computer and use it in GitHub Desktop.
Save anonymous/f0fa2842afb7b3c2a085 to your computer and use it in GitHub Desktop.
laravel5 Nginx
server {
listen 80;
root /var/www/xxx/public;
server_name xxx;
index index.php index.html index.htm;
error_log /var/log/nginx/tux-control-debug debug;
# Disallow access to hidden files (.htaccess, .git, etc.)
location ~ /\. {
deny all;
}
# Some locations will never contain PHP files, handle it in the server
location ~ ^/(robots.txt|favicon.ico)(/|$) {
try_files $uri =404;
}
location = /index.php {
# Disable direct access to the source code of index.php. If you have a
# Laravel route for '/index.php', copy the @php_router block below.
return 404;
}
location / {
# Try to serve the static files, otherwise call into PHP
try_files $uri $uri/ @php_router;
}
location @php_router {
include fastcgi_params;
# If you move index.php outside public/, adjust it here.
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment