-
-
Save EduardoOliveira/978997b399bb44e53ce5 to your computer and use it in GitHub Desktop.
laravel5 Nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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