Skip to content

Instantly share code, notes, and snippets.

@dmgallardo
Forked from mariano-aguero/nginx.conf
Created February 9, 2017 16:16
Show Gist options
  • Save dmgallardo/afbb41b641292177b46333a1d22f8702 to your computer and use it in GitHub Desktop.
Save dmgallardo/afbb41b641292177b46333a1d22f8702 to your computer and use it in GitHub Desktop.
File nginx.conf to use in centos servers
user nginx;
worker_processes 1; #2
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
worker_rlimit_nofile 20000;
events {
worker_connections 10000;
multi_accept on;
accept_mutex on;
# accept_mutex_delay 500ms;
use epoll;
}
http {
client_body_buffer_size 32K;
client_body_in_single_buffer on;
client_header_buffer_size 3m;
client_max_body_size 31m;
large_client_header_buffers 4 64k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
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 off;
sendfile on;
tcp_nodelay on;
tcp_nopush on;
aio on;
directio 4m;
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 30;
keepalive_requests 1000;
send_timeout 2;
server_tokens off;
reset_timedout_connection on;
#some cache configurations
open_file_cache max=10000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
gzip on;
gzip_comp_level 5;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 1024;
#Limit connection regarding flooding
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_conn_log_level notice;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=15r/s;
include /etc/nginx/conf.d/*.conf;
index index.html index.htm;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location / {
}
# redirect server error pages to the static page /40x.html
#
error_page 404 /404.html;
location = /40x.html {
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment