Created
September 8, 2020 12:47
-
-
Save thiagoprz/48032e3af0fcd16348c7dc0a4884471e to your computer and use it in GitHub Desktop.
Configuração de host para servidor Nginx utilizado pelo Laravel (5.5+)
This file contains hidden or 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
fastcgi_cache_path /etc/nginx-cache levels=1:2 keys_zone=phpcache:100m inactive=60m; | |
fastcgi_cache_key "$scheme$request_method$host$request_uri"; | |
server { | |
client_max_body_size 100M; | |
root /home/$$USER$$/$$DIRECTORY$$; | |
index index.php index.html index.htm; | |
server_name _; | |
charset utf-8; | |
gzip on; | |
gzip_vary on; | |
gzip_disable "msie6"; | |
gzip_comp_level 6; | |
gzip_min_length 1100; | |
gzip_buffers 16 8k; | |
gzip_proxied any; | |
gzip_types | |
text/plain | |
text/css | |
text/js | |
text/xml | |
text/javascript | |
application/javascript | |
application/x-javascript | |
application/json | |
application/xml | |
application/xml+rss; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
fastcgi_cache phpcache; # The name of the cache key-zone to use | |
fastcgi_cache_valid 200 30m; # What to cache: 'Code 200' responses, for half an hour | |
fastcgi_cache_methods GET HEAD; # What to cache: only GET and HEAD requests (not POST) | |
add_header X-Fastcgi-Cache $upstream_cache_status; # Add header so we can see if the cache hits or misses | |
try_files $uri /index.php =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/run/php/php7.3-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)$ { | |
expires 1M; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
location ~* \.(?:css|js)$ { | |
expires 7d; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment