Several Common commands for installation and debugging of LinuxSquid

Source: Internet
Author: User
Article Title: Several Common commands for installation and debugging of LinuxSquid. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1. initialize the cache directory you configured in squid. conf.

# Squid/sbin/squid-z // This command is required when you start the squid service for the first time

If an error message is displayed, check the permission of your cache directory.

2. Check the syntax and configuration of squid. conf.

# Squid/sbin/squid-k parse

If squid. conf has a syntax or configuration error, a prompt will be returned. If no result is returned, congratulations, you can try to start squid.

3. Start squid on the frontend and output the startup process.

# Squid/sbin/squid-N-d1

If there is ready to server reques, congratulations, the startup is successful.

Press ctrl + c to stop squid and start it later.

4. Start squid to run in the background.

# Squid/sbin/squid-s

At this time, you can view the system process in ps-A, and you can see two squid processes.

5. Stop squid

# Squid/sbin/squid-k shutdown

You don't need to explain this.

6. Reboot the modified squid. conf file.

# Squid/sbin/squid-k reconfigure

This estimation is often used. You can modify squid at any time when you find that your configuration is not satisfactory. conf, and then do not forget your squid. conf troubleshooting, and then execute this command to let the running squid repeat your squid. conf to run.

7. Add the squid to the system startup Item

Edit/etc/rc. d/rc. local

Add the following lines:/usr/local/squid/sbin/squid-s

Of course, not everyone likes this startup method. You can use the method you like most or install it as a service.

Click another one.

1. Modify the cache directory permissions.

# Chown-R squid: squid/home/cache

My cache directory is/home/cache. The squid execution user and user group are squid and squid.

2. Modify squid log directory permissions

# Chown-R squid: squid/usr/local/squid/var/logs

This step is not suitable for every user who uses squid. Indicates that squid has the permission to perform write operations in this directory.

For example, generate access. log cache. log store. log

3. view your log document.

# More/usr/local/squid/var/logs/access. log | grep TCP_MEM_HIT

This command shows that some files are cached into the memory by squid during squid operation and returned to the access user.

# More/usr/local/squid/var/logs/access. log | grep TCP_HIT

This command shows that during the squid operation, the files are cached by squid into the cache directory and returned to the access user.

# More/usr/local/squid/var/logs/access. log | grep TCP_MISS

This command shows that some files are not cached by squid during squid operation, but are retrieved from the original server and returned to the accessed user.

For information on parameters and representatives such as TCP_XXXX, see Chapter 13.2.1 of www.chinaunix.org Peng Yonghua's squid Chinese authoritative guide.

Of course, the blue text in this example can be changed to other parameters, for example, your domain name www.xxxx.com, you can also see the access. log line about this domain name.

4. squid-k rotate the squid log file/var/log/squid, Squid Proxy Server log File

The increase speed is amazing, it is easy to take a penalty full disk space, resulting in the system not working properly, or even a crash. To solve the problem that log files are growing too fast, squid adopts the "rotation" method. In squid. conf, you can use logfile_rotate to set the number of file rotations, for example:

Logfile_rotate 10. Generally, the crontab timer is used to rotate logs cyclically. For example, to rotate logs at every Saturday, run the following command: crontab-e.

0 2 ** 6 squid-k rotate

Tip: the default error message of Squid is in English, which is inconvenient for users with poor English. Add the following in/etc/squid. conf:

Error_directory/usr/share/squid/errors/Simplify_Chinese to display Chinese error messages.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.