Updated 14 days ago
Nginx is a widely used webserver, which ranks for better choice to serve static and dynamic web content faster. In present era, computing resources are shaped up in broader room. Optimization of service holds up as a priority to use these resources optimally. Nginx optimization is the one, which this article speaks about.
Generally in linux systems, nginx config files can be located in /etc/nginx among it nginx.conf is main config file. Tuning parameters found in this file to correct values thumbs up performance. Following points projects how to do it.
It can be considered as one worker process per processor core.
It helps nginx to keep open file descriptors (modification time, file and directory parameters) to serve fast. "open_file_cache max=10000 inactive=30s" Sets maximum of 10000 files and valid for 30 sec, can be tuned respective to available memory.
It is which client maximum request body size. Tune it with proper value to avoid (413 Request entity to large error), here we keep it as 100MB. "client_max_body_size 100M"
II. Virtual host file:
1. Cache Control for Static Files
These config makes nginx to perform better, when compared to default settings.
Note: Optimizing FastCGI Process Manager like "PHP-FPM" is an another post.