Skip to content

Instantly share code, notes, and snippets.

@sofianhw
Last active February 5, 2016 10:29
Show Gist options
  • Save sofianhw/bf206e95061bcc03beb8 to your computer and use it in GitHub Desktop.
Save sofianhw/bf206e95061bcc03beb8 to your computer and use it in GitHub Desktop.
Nginx configuration for static content
server {
listen 80;
root /var/www/html/data;
location /images/ {
#Enabling the sendfile directive will eliminate the step of copying the data into the buffer and enables direct copying data from one file descriptor to anothers
sendfile on;
#To prevent one fast connection to entirely occupy the worker process, you can limit the amount of data transferred in a single sendfile() call by defining the sendfile_max_chunk directive
sendfile_max_chunk 1m;
#Use the tcp_nopush option together with sendfile on;. The option will enable NGINX to send HTTP response headers in one packet right after the chunk of data has been obtained by sendfile
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
}
}
@sofianhw
Copy link
Author

sofianhw commented Feb 5, 2016

sudo sysctl -w net.core.somaxconn=4096

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment