• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

What's your best nginx.conf for better performance ?

Johan06

New Pleskian
Hello,

I'm just wondering what's your best optimization / tips for better performance in nginx.conf
Sure it depend of what you use (fpm, fastcgi, etc...)

I'm asking to compare and see what can I do in my own conf below :

Code:
#user  nginx;
worker_processes  auto;

#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;
    multi_accept on;
}


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

    client_header_timeout 3000;
    client_body_timeout 3000;
    client_max_body_size 32m;

    fastcgi_read_timeout 3000;
    fastcgi_send_timeout 3000;
    fastcgi_connect_timeout 3000;
    fastcgi_buffers 16 128k;
    fastcgi_buffer_size 128k;

    proxy_buffers 16 128k;
    proxy_buffer_size 128k;



    #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;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    gzip_comp_level 9;
    gzip_http_version 1.1;
    gzip_proxied any;
    gzip_min_length 10;
    gzip_buffers 16 8k;
    gzip_types text/plain text/css application/javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;

    # Disable for IE < 6 because there are some known problems
    gzip_disable “MSIE [1-6].(?!.*SV1)”;

    # Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
    gzip_vary on;

    server_tokens off;



    server {
        listen 80;
        index index.php index.html;

    }



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

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
 
Hello,

Plesk Support does not provide any performance customizations for nginx and other services.

I can only suggest to make sure that you have increased worker_rlimit_nofile setting in case of huge amount of websites.
 
Ok, I just wondering what other user did with their own config. Like more a sharing experience than a support ask.

My server will contain 100 websites max.
How can I define the right number to use for worker_rlimit_nofile ?

Thanks for your suggestion.
 
@Alex@Odin

Thanks for the correction of your previous suggestion.

Setting or adjusting the modify worker_rlimit_nofile is often not necessary at all and, moreover, can be very dangerous in the presence of specific other Nginx or php related settings.

It is simply not the best way of tweaking performance and/or optimizing Nginx performance.

Regards....
 
@Alex@Odin

Thanks for the correction of your previous suggestion.

Setting or adjusting the modify worker_rlimit_nofile is often not necessary at all and, moreover, can be very dangerous in the presence of specific other Nginx or php related settings.

It is simply not the best way of tweaking performance and/or optimizing Nginx performance.

Regards....
It is required when default file limit is reached. This is related only for systems with huge amount of websites.
 
@Alex@Odin,

It is required when default file limit is reached. This is related only for systems with huge amount of websites.

The whole concept of tweaking performance and settings is to prevent such situations to be occurring. Again, a very dangerous comment from your side.

If you don´t want to hear it from me, please contact the Nginx Inc. team, they are happy to tell you all about the nature, history of and necessity for this particular directive.
 
Dear trialotto,

If you want to clarify this point, please contact me personally. This statement is taken from our service team, worker_rlimit_nofile should be modified to allow nginx to work properly with huge amount of domains if file limit is reached.
 
Back
Top