In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces "how to accelerate nginx performance" in detail, with detailed content, clear steps and proper handling of details. I hope this "how to accelerate nginx performance" article can help you solve your doubts.
Turn on gzip
Configuration
# enable gzipgzip on;# to enable gzip compression of the minimum files, files less than the set value will not be compressed gzip_min_length 1kth # gzip compression level, 1-10. The larger the number, the better the compression, and the more time it takes up cpu. The file types to be compressed by gzip_comp_level 2th # will be described in detail later. Javascript comes in many forms. The values can be found in the mime.types file. Whether gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;# adds vary: accept-encoding to http header, it is recommended to enable gzip_vary on;# to disable ie 6 gzipgzip_disable "msie [1-6]\."
Gzip_comp_level parameter
For the reasonable value of gzip_comp_level, you can refer to the following figure. From
It can be seen from the figure that the effect is not obvious when gzip_comp_level is greater than 2. So you can set the value to 1 or 2.
Turn on caching
Configuration
Location ~ * ^. +\. (ico | gif | jpg | jpeg | png) ${access_log off; expires 30d;} location ~ * ^. +\. (css | js | txt | xml | swf | wav) ${access_log off; expires 24h;} location ~ * ^. +\. (html | htm) ${expires 1h;}
The cache time can be modified as needed.
About fonts
Enabling caching for static resources can reduce server bandwidth consumption, especially when fonts are used in css, and combined with gzip compression can greatly reduce the bandwidth impact of downloading fonts.
Set font cache
It is important to note that fonts have many formatting, and it is necessary to set caching for all font formats.
Location ~ * ^. +\. (eot | ttf | otf | woff | svg) ${access_log off; expires max;}
Enable gzip
You only need to enable gzip for ttf, otf, and svg fonts, and the effect of gzip compression on other font formats is not obvious.
Gzip_types font/ttf font/otf image/svg+xml
For the compression effect of various font types, please refer to the following test results:
You can see that the effect of gzip compression on woff and eot is not good.
Font summary
Whether the extension is compressed content-type.eot No application/vnd.ms-fontobject.ttf is font/ttf.otf is font/opentype.woff or font/x-woff.svg is image/svg+xml. This article "how to accelerate nginx performance" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it to understand it. If you want to know more about related articles, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.