Linux server-squid cache
Squid cache
Proxy servers cache on local hard disks to improve network efficiency
1 Modify squid configuration file "/etc/squid/squid.conf", parameter "cache_dir_ufs" is to set 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: . [OK]
[root@localhost wj]# gedit /etc/squid/squid.conf
[root@localhost wj]# service squid restart
Stop squid: 2018/08/15 11:17:31| WARNING cache_mem is larger than total disk cache space!
................ [OK]
init_cache_dir /var/spool/squid... Starting squid: . [OK]
[root@localhost wj]#
3. Check the squid cache directory, where swap.state will gradually increase with the number of web pages visited.
[root@localhost wj]# ls -al /var/spool/squid/
Total consumption 76
drwxr-x--- 18 squid squid 4096 August 15 11:18 .
drwxr-xr-x. 15 root 4096 Aug 15 10:50..
drwxr-x--- 258 squid squid 4096 August 15 11:18 00
drwxr-x--- 258 squid squid 4096 August 15 11:18 01
drwxr-x--- 258 squid squid 4096 August 15 11:18 02
drwxr-x--- 258 squid squid 4096 August 15 11:18 03
drwxr-x--- 258 squid squid 4096 August 15 11:18 04
drwxr-x--- 258 squid squid 4096 August 15 11:18 05
drwxr-x--- 258 squid squid 4096 August 15 11:18 06
drwxr-x--- 258 squid squid 4096 August 15 11:18 07
drwxr-x--- 258 squid squid 4096 August 15 11:18 08
drwxr-x--- 258 squid squid 4096 August 15 11:18 09
drwxr-x--- 258 squid squid 4096 August 15 11:18 0A
drwxr-x--- 258 squid squid 4096 August 15 11:18 0B
drwxr-x--- 258 squid squid 4096 August 15 11:18 0C
drwxr-x--- 258 squid squid 4096 August 15 11:18 0D
drwxr-x--- 258 squid squid 4096 August 15 11:18 0E
drwxr-x--- 258 squid squid 4096 August 15 11:18 0F
-rw-r---- 1 squid squid 52 August 15 11:18 swap.state
[root@localhost wj]#
4. Clean up the cache regularly
Swap.state grows larger in the squid cache directory and the user needs to clear the file periodically, or do a scheduled task to clear it.
Made a Linux learning platform, currently out of a shape, you can refer to the use
Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ Password: n7bk