nginx.conf – sample configuration of Nginx proxy server for a quick start

This is the main configuration file for Nginx proxy server for a quick start. I use it on almost all of my web servers. At the end of this config file, you will notice a directive “include /etc/nginx/conf.d/*.conf;” folder. Nginx will check this directory for any config files, which can be multiple once based on your infrastructure setup.

user  nginx;
worker_processes  2;
worker_rlimit_nofile 100000;

events {
worker_connections  10240;
multi_accept on;
}

http {
include mime.types;
default_type  application/octet-stream;
log_format main ‘$remote_addr – $remote_user [$time_local]  $status ‘
‘”$request” $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;

client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffering on;
proxy_buffer_size 32k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;

keepalive_timeout  65;

#SSL tweeks
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

# Here goes the compression
gzip on;
gzip_comp_level 6;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied any;
gzip_types    text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
gzip_disable “msie6”;

include /etc/nginx/conf.d/*.conf;
}

Leave a Reply

Your email address will not be published. Required fields are marked *