• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Nginx best config

Amin Taheri

Golden Pleskian
Plesk Certified Professional
Hi guys,

I want to try and figure out what the best configuration is for nginx, I'd appreciate if you would share your configs - at least the entires that may differ from mine - and hopefully we can get a best config out there that others can use

Code:
#user  nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}


http {
    include       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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    #keepalive_timeout  65;
    keepalive_requests 100;

    #tcp_nodelay        on;

    gzip  on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_min_length 1000;
    gzip_proxied no-cache no-store private expired auth;

    server_tokens off;

    keepalive_timeout  125;
    proxy_read_timeout 300s;
    proxy_buffer_size               128k;
    proxy_buffers                   16 256k;
    proxy_busy_buffers_size         256k;

    fastcgi_buffering               on;
    fastcgi_buffer_size             128k;
    fastcgi_buffers                 16 256k;

    fastcgi_connect_timeout         600s;
    fastcgi_send_timeout            600s;
    fastcgi_read_timeout            600s;

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

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
 
Last edited:
Back
Top