Preface * with the development of the entire Internet, there have been countless websites, large and small. As a result, users are increasingly enhancing their website UI and speed experience. For enterprises or individuals, winning the user experience means winning the lead.
Today, we are here to talk about the website speed. Improving the website speed is crucial for O & M engineers and programmers. O & M engineers must first find various factors 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 include Varnish, Nginx_proxy, and Squid. As Nginx WEB High-Speed Reverse Proxy is used by various large and medium-sized websites, its integrated cache function Nginx_proxy) it is also increasingly powerful and is also widely used by enterprises. Today, we will study how the Nginx_Proxy cache can be effectively cleared. The script is as follows:
#! /Bin/sh
# Auto Clean Nginx Cache Shell Scripts
#2013-06-12 wugk
# Define Path
CACHE_DIR =/data/www/proxy_cache_dir/
FILE = "$ *"
# To determine whether the input script, If not, then exit To determine whether the script has input, no input, and then exit
If
["$ #"-Eq "0"]; then
Echo "Please Insert clean Nginx cache File, Example: $0 index.html index. js"
Sleep 2 & exit
Fi
Echo "The file: $ FILE to be clean nginx Cache, please waiting ....."
# Wrap processing for the input file, for grep lookup, to Wrap the input file, facilitating grep searching for Matching content
For I in 'echo $ FILE | sed's // \ n/g''
Do
Grep-ra $ I $ {CACHE_DIR} | awk-F ': ''{print $1}'>/tmp/cache_list.txt
For j in 'cat/tmp/cache_list.txt'
Do
Rm-rf $ j
Echo "$ I $ j is Deleted Success! "
Done
Done
# The Scripts exec success and exit 0
After the script is cleared:
650) this. length = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1P10T136-0.png "title =" nginx cache "width =" 700 "height =" 227 "border =" 0 "hspace =" 0 "vspace =" 0 "style =" width: 700px; height: 227px; "/>
This article from the "Wu guangke-Focus on automated O & M" blog, please be sure to keep this source http://wgkgood.blog.51cto.com/1192594/1220828