Press "Enter" to skip to content

Must do in nginx configuration

Sharing is caring!

Nginx is widely used web server and best one available around. It is best known for its ability to handle the heavy traffic easily. More importantly, for developers, its configuration seems to be flexible one in compare to Apache or any other servers out there.

Here, in this post we are listing must do activities for configuring nginx servers. Some of these helps us to make our web application faster too.

Gzip support – gzip is a popular data compression program. You can configure Nginx to use gzip to compress files it serves on the fly. Those files are then decompressed by the browsers that support it upon retrieval with no loss whatsoever, but with the benefit of smaller amount of data being transferred between the web server and browser.

Cache resource – Every website has pages, images and other stuff which remains mostly unchanged during the visitor’s session on the site. Almost 30 percent data on the modern day web pages is static, such content should be cached in order to improve performance of Nginx. Caching will give you two benefits.

Disable access log – Nginx logs have too much information coming in them as each and every action is being logged. To improve its performance you can disable these logs and it will eventually save disk space also. Nginx configuration file should contain following parameter if you are looking to disable access logs.

Open file cache – On Linux based operating systems everything is being done using files. Open_file_cache parameter allows the server to cache file descriptors and all the frequently accessed files. You can enable this tweak by adjusting the following parameters.

HTTP2 support – HTTP/2 will make our applications faster, simpler, and more robust—a rare combination—by allowing us to undo many of the HTTP/1.1 workarounds previously done within our applications and address these concerns within the transport layer itself. Even better, it also opens up a number of entirely new opportunities to optimize our applications and improve performance!

HTTPS support: Web has been closing in to HTTPS protocol ditching previous ones. Most of the top websites have migrated already to HTTPS. And for a number of good reasons, this is necessary.


That is it for now.

Everything is awesome.


Be First to Comment

    Leave a Reply

    Your email address will not be published.