Squid cache
The proxy server sets the cache on the local hard disk , This can improve network efficiency
1, modify squid configuration file “/etc/squid/squid.conf”, parameter “cache_dir_ufs” It is used to set the cache directory
[root@localhost wj]# gedit /etc/squid/squid.conf
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 100 16 256 // Cache directory var/spool/squid, size 100M
2, restart squid service
[root@localhost wj]# service squid start
Starting squid:. [ determine ]
[root@localhost wj]# gedit /etc/squid/squid.conf
[root@localhost wj]# service squid restart
stop it squid:2018/08/15 11:17:31| WARNING cache_mem is larger than total disk cache space!
................ [ determine ]
init_cache_dir /var/spool/squid... Starting squid:. [ determine ]
[root@localhost wj]#
3, see squid Cache directory , among swap.state It will increase with the increase of visiting web pages
[root@localhost wj]# ls -al /var/spool/squid/
Total dosage 76
drwxr-x--- 18 squid squid 4096 8 month 15 11:18 .
drwxr-xr-x. 15 root root 4096 8 month 15 10:50 ..
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 00
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 01
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 02
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 03
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 04
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 05
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 06
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 07
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 08
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 09
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 0A
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 0B
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 0C
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 0D
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 0E
drwxr-x--- 258 squid squid 4096 8 month 15 11:18 0F
-rw-r----- 1 squid squid 52 8 month 15 11:18 swap.state
[root@localhost wj]#
4, Clean up cache periodically
stay squid In the cache directory ,swap.state It's getting bigger , Users need to clear this file regularly , Or you can do a scheduled task to clear .
Technology