Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Last active January 16, 2018 18:03
Show Gist options
  • Save StevenJL/99448cdb39ab82aa10f02e7b38019902 to your computer and use it in GitHub Desktop.
Save StevenJL/99448cdb39ab82aa10f02e7b38019902 to your computer and use it in GitHub Desktop.
# Every `http` block must contain at least one `server` block which
# defines http and/or https virtual hosts.
server {
# Have a server listen to port 80, the standard HTTP port
listen 80;
# `server_name` creates a virtual host and sets its names
server_name staticcontent.com;
# Set the location of the access, where nginx writes information
# about every client request.
access_log /var/log/nginx/staticcontent.com-access.log main;
# Tell nginx to use the sendfile() system call, for more efficient
# retrieval of static files. The maximum send file chunk is set
# at 1 Mb. We also enable tcp segment optimization with the
# `tcp_nopush` option,
sendfile on;
sendfile_max_chunk 1M;
tcp_nopush on;
# Let nginx check for gzipped versions of static files, and if they are
# found, will send the compressed files instead and indiciate the .gzip
# character encoding, improving client downloading speeds as compressed
# assets are loaded instead.
gzip_static on;
# `root` specifies the directory which contains these static files.
root /usr/local/www/staticcontent.com;
}
# vim: ft=nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment