Aysad Kozanoglu - Mimarist

Server Howtos & Tutorials

Nginx performance tuning Einstellungen

08 April, 2016 | config Dateien

aus meinem produktivumgebung (hallotaxi24)


worker_processes auto;
worker_rlimit_nofile 100000;

# provides the configuration file context 
#in which the directives 
#that affect connection processing are specified.

events {
    # determines how much clients will be served per worker
    # max clients = worker_connections * worker_processes
    # max clients is also limited by the number of socket connections available on the system (~64k)
    worker_connections 4000;

    # optmized to serve many clients with each thread, essential for linux
    use epoll;

    # accept as many connections as possible, may flood worker connections if set too low
    multi_accept on;

http {
	include       mime.types;
	default_type  application/octet-stream;
	server_tokens off;

        add_header X-Frame-Options SAMEORIGIN;

	# cache informations about FDs, frequently accessed files
	# can boost performance, but you need to test those values

	open_file_cache max=200000 inactive=20s; 
	open_file_cache_valid 30s; 
	open_file_cache_min_uses 2;
	open_file_cache_errors on;

	# copies data between one FD and other from within the kernel
	# faster then read() + write()
	sendfile on;

	# send headers in one peace, its better then sending them one by one 
	tcp_nopush on;

	# don't buffer data sent, good for small data bursts in real time
	tcp_nodelay on;

	# server will close connection after this time
	keepalive_timeout 30;

	# number of requests client can make over keep-alive -- for testing
	keepalive_requests 100000;

	# allow the server to close connection on non responding client, this will free up memory
	reset_timedout_connection on;

	# request timed out -- default 60
	client_body_timeout 10;

	# if client stop responding, free up memory -- default 60
	send_timeout 2;

    server {
        listen       80;
        server_name  NoProxy;
        return 444;

        location / {
            #root   html;
            #index  index.html index.htm;

	include "/usr/local/nginx/conf/enabled/*.conf";