Statistics on snginx logs to view nginx cache hit rate
To calculate the nginx cache, make sure that you have configured the nginx cache, and then output the cache status in the log, as
affecting the website speed in Daily website O M and then solve them one by one.
In addition to website program optimization, there is still a lot of work to be done for LinuxSA to improve website speed and experience, optimizing the system kernel, adjusting WEB Server parameters, optimizing the database, and adding the website architecture cache.
For website cache, the mainstream HTTP accelerators includ
Tags: proxy nginx cacheThe principle of building image caching mechanism is to reduce the burden of database and speed up the response of static resources.Steps:1.Vim/usr/local/nginx/conf/nginx.conf2.http{. #设置Web缓存区名称为cache_one, the memory cache space size is 200mb,1 days without access to the content is automatically cleared, the hard disk
Nginx image, css, and js Cache
At the beginning, we set up the nginx environment to achieve load balancing and distributed clusters. Now we can use the nginx cache mechanism to optimize the speed. The following describes the cache
Improve web site speed experience in addition to its own web site program optimization, for LINUXSA, there are a lot of work to do, optimize the system kernel, adjust the parameters of the Web server, optimize the database, increase the Web site architecture cache, and so a series of work.
For Web caching, the current mainstream HTTP accelerator is mainly varnish, nginx_proxy, squid, etc., with the Nginx W
Foreword * With the development of the whole Internet, has produced numerous big and small website, along with the user to the website UI and the speed experience also is strengthening, to the enterprise or the individual, wins the user experience also means to win the opportunity.
So today we are here to communicate with the speed of the site, to improve the speed of the site for the operation of engineers, programmers become critical. Operational engineers must first of all in the daily websi
requires updated URL, add #refresh配置成自动触发更新to URLTest results:
DEMO:1. Installing memcachedUnzip, run memcached.exe-d install in CMD after running successfully installed the memcached service in the Windows service , start it. You can determine if the installation started successfully by Telnet 127.0.0.1 112112. Run a ASPNET Web siteThe URL of the /report path under the page we will cache thes 3. Run ngin
cutsh /usr/local/sbin/nginx_log_rotate.shls /tmp/*log*3 Configure static files do not log logs, configure cache expiration timeThe requirements are the same as httpd, but the configuration is much simpler. Change the virtual host configuration file to the following:server{ listen 80; server_name test.com test1.com test2.com; index index.html index.htm index.php; root /data/wwwroot/test.com; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
Seemingly never written nginx caching function, are only to see not to share, this is bad habit ah.
1, one of the traditional cache (404)
This approach is to nginx 404 errors to the back end, and then use Proxy_store to save the back-end page.
Configuration:
location / { root /home/html/;#主目录 expires 1d;#网页的过期时间 error_page 404 =200 /fetch$request_uri;#404定向到/
One: Nginx configure expires cache to boost website loadFor pictures of the website, especially news stations, once published, the changes may be very small. We want to be able to cache the image cached on the user's browser for a long time after the user has visited it. You can use the Nginx expires setting to set the
Method 1 The code is as follows:Copy code Server {#... N rows of configuration are omitted here# Example:/thumb/export md52.16.png_300x187.pngLocation ~ "/Thumb/([0-9a-f] {32 }. (png | jpg | gif) _ (d + |-) x (d + | -). (png | jpg | gif) $ "{Access_log off;Set $ image $1;Set $ width $3;Set $ height $4;# We recommend that you use try_files instead of ifTry_files/thumb/$ image = 404;Image_filter resize $ width $ height;Image_filter_buffer 10 M;# It will only be cached on the browser
information cached by the browser can also be set in Nginx, as follows.
#配置在server节点下
#将favicon. ico is placed in the HTML directory of the Nginx installation directory
location =/favicon.ico {
root html;
Index index.html index.htm;
Expires 30d; #会同时设置Expires and Cache-control:max-age
add_header Pragma Pragma;
}
After the settin
This article mainly introduces about Nginx Memcache cache Introduction, has a certain reference value, now share to everyone, the need for friends can refer to
1 basic
In a LNMP architecture, Nginx encounters a dynamic resource, reverses the proxy, sends the request to the backend PHP-FPM service, PHP-FPM reads the data from MySQL, produces the page, and then re
(All CentOS system commands in this article are represented by Italic bold, so you can read it)Attention! I use LNMP script mode installation of Nginx 1.8.0 stable version, if it is downloaded from the official website version, nginx.conf configuration file a little different, but the skeleton is identical, do not delay reading.Cache SettingsNginx server caching capability is still worth certain, the server cache
Objective: To cache static files on the nginx server. Such as CSS, JS, htm, HTML, JPG, GIF, PNG, FLV, SwF, these files are not updated frequently. It is easy to cache to reduce the pressure on the server.Implementation: nginxproxy_cache can cache users' requests to a local directory. When the next request is sent, the
Using squid as a directional proxy server can function like Nginx, and can store cached content in memory, Nginx cache content on a hard disk, and configure the same principle as nginx, squid himself works as a Web server, Direction proxy to the backend Web server to the user.
1. Install SquidTAR-ZXVF squid-3.4.10.tar
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.