Skip to content

Instantly share code, notes, and snippets.

@simbo
Created September 23, 2019 11:22
Show Gist options
  • Save simbo/2e0558bcbbcda42fbb1ec429e29c2245 to your computer and use it in GitHub Desktop.
Save simbo/2e0558bcbbcda42fbb1ec429e29c2245 to your computer and use it in GitHub Desktop.
user nginx;
worker_processes 1;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
}
http {
sendfile on;
sendfile_max_chunk 1m;
tcp_nopush off;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
types {
text/plain txt;
text/html html;
text/css css;
application/javascript js;
application/json json;
image/png png;
image/jpeg jpeg jpg;
image/gif gif;
image/x-icon ico;
image/svg+xml svg svgz;
application/font-woff woff;
application/font-woff2 woff2;
application/x-font-ttf ttf;
}
default_type application/octet-stream;
map $sent_http_content_type $expires {
text/plain max;
text/html epoch;
text/css max;
application/javascript max;
application/json max;
image/png max;
image/jpeg max;
image/gif max;
image/x-icon max;
image/svg+xml max;
application/font-woff max;
application/font-woff2 max;
application/x-font-ttf max;
}
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 8;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain
text/css
application/javascript
application/json
image/svg+xml;
server {
listen 80 default_server;
root /htdocs;
index index.html;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
client_body_buffer_size 8K;
client_header_buffer_size 4k;
client_max_body_size 64M;
large_client_header_buffers 2 4k;
expires $expires;
location = /favicon.ico {
try_files /favicon.png /favicon.ico =204;
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
}
location = /index.html {
add_header Cache-Control no-cache;
try_files $uri =404;
}
location ~* \.(html?|css|js|json|txt|jpe?g|png|gif|svg|ico|woff2?|ttf)$ {
try_files $uri =404;
}
location / {
try_files $uri $uri/ @app;
}
location @app {
rewrite ^ /index.html;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment