Skip to content

Instantly share code, notes, and snippets.

@LTroya
Created September 17, 2020 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LTroya/c6496075033c8b6e15fdaaf0d9584482 to your computer and use it in GitHub Desktop.
Save LTroya/c6496075033c8b6e15fdaaf0d9584482 to your computer and use it in GitHub Desktop.
Nginx config
server {
listen 80;
listen [::]:80;
server_name laravel8.io;
root /var/www/learning/laravel8/public;
index index.php index.html index.htm;
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100; gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $request_filename;
#fixes timeouts
fastcgi_read_timeout 600;
include fastcgi_params;
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires -1;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires -1;
access_log off;
add_header Cache-Control "public";
}
location ~ /\.ht {
deny all;
}
location /.well-known/acme-challenge/ {
root /var/www/letsencrypt/;
log_not_found off;
}
error_log /var/log/nginx/credefi_error.log;
access_log /var/log/nginx/credefi_access.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment