Squid website acceleration in Windows

Source: Internet
Author: User
  •  

    Notes on using squid for website acceleration in Windows

    23:39:43 large, medium and small cases:
    We have a website named dummy.example.com. The original site was only built on a telecommunications server, but as the business needs arise, more and more Netcom users also need to visit our site, in this case, we need to set up a set of telecom sites on the Netcom server to provide services for the Netcom users. For users, both telecom users and China Netcom users only need to use the same domain name: dummy.example.com to achieve satisfactory access speed. First, we need to solve the proximity judgment of domain names, or the problem of intelligent DNS. Currently, there are two commonly used methods, first, the domain name resolution work should be handed over to service providers that provide CDN solutions such as chinanetcenter to complete the DNS resolution work. Of course, smart DNS resolution services are also provided free of charge on the Internet, such. This article mainly introduces the application of the Squid cache server and takes DNS resolution as a whole. Next, let's talk about the problems encountered by the website:
    1. Because the website belongs to a site similar to news publishing, most pages are published in the background by generating static pages. That is, some static pages will be generated from time to time as the website is updated every day.
    2. images on the website are uploaded through the background and occasionally updated every day.
    3. Once released in the background, the telecommunications and China Netcom sites are synchronously updated. The telecom site has been established and runs normally. Every day, static pages and images will be generated and uploaded from time to time. If we build the same web site as China Telecom on the Netcom site, it is inevitable that the content between the two sites will not be synchronized. If file synchronization and other methods are used for execution, there will be problems with the access to the website during the synchronization period, second, synchronization works frequently between the China Netcom line and the China Telecom line, which is very troublesome.
    Therefore, we want to build a cache server for website acceleration on the Netcom node and direct the source to the Telecom server, instead of creating a web site. In this way, the first access to a page is relatively slow, and it is not suitable for dynamic pages in many cases. The software used by the cache server is squid, and squid is ideal for running in Unix-like operating systems. Because the Netcom site does not have a Linux server, squid software in Windows is only available, version is a squid-2.6.STABLE3. The squid configuration process in Windows is as follows:
    1. Get the latest squid for Windows NT at http://www.acmeconsulting.it/squidnt.htm.
    2. Unzip to C:/squid
    3. In the C:/squid/etc directory,
    Copy and rename the follwing files:
    Squid. conf. Default ==> squid. conf
    Mime. conf. Default => mime. conf
    Cachemgr. conf. Default => cachemgr. conf
    4. Create the D:/squid/var directory and create the logs and cache directories under the VaR directory. The logs directory is used to store logs and the cache directory is used to store hard disk cache data.
    5. Create a system account squid, which belongs to a common user group and will be used to run the squid service in the future. Grant the squid read and write permissions to the D:/squid directory.
    6. Install squid as a Service. The command format is squid-I [-F configfile] [-N servicename], for example, C:/squid/sbin/squid-I-n squid_proxy, the default configuration file C:/squid/etc/squid will be used. conf, the service name is squid_proxy. Delete service: Squid-R [-N servicename]
    7. modify the configuration file squid. conf.
    # Listen to port 80 and set it to acceleration Mode
    Http_port 80 vhost
    # UDP port for communication between cache servers
    Icp_port 3130
    # Cache Server Name
    Visible_hostname cache.example.com
    # Cache directory and size settings, 1 GB hard disk space and MB memory
    Cache_dir ufs d:/squid/var/cache 1024 16 256
    Cache_mem 256 MB
     
    # Set the address of the parent root server, that is, the address of the e-source server
    # Of course, cache_peer can also set sibling nodes and upper-level cache servers. Here, the source server address is set.
    Cache_peer telecommunications Server IP address parent 80 0 no-query originserver
     
    # Host file path
    Hosts_file C:/Windows/system32/Drivers/etc/hosts
     
    # Setting the log directory and log format
    Access_log D:/squid/var/logs/access. Log squid
    Cache_log D:/squid/var/logs/cache. Log
    Cache_store_log D:/squid/var/logs/store. Log
    Emulate_httpd_log on
     
    # Allow all users to access
    Http_access allow all
    # Cache Administrator
    Cache_mgr webmaster@example.com
     
    8. initialize the cache directory
    C:/squid/sbin/squid-z
    If an error occurs in the configuration file, the cache directory initialization will fail.
    9. Start the squid_proxy service.
    Run services. MSC. Open the service window, select the squid_proxy service, and set the startup account to the squid. Net start squid_proxy
    10. Check whether the cache server is running normally.
    Find a terminal, modify the hosts file of the terminal, point dummy.example.com to the IP address of the cache server, and check whether the website is accessed normally. 11. Other squid commands squid-K reconfigure // enable the new configuration file squid-K rotate // truncation log squid-K shutdown/Stop squid previously used squid in Linux environment use, there are still some problems with squid in windows, one of which is:
    If you have any questions about how to use the host header file on the Cache Server:
    China Telecom server IP address dummy.example.com
    Modify the configuration of cache_peer in Squid. conf:
    Cache_peer dummy.example.com parent 80 0 no-query originserver
    After the squid service is restarted, Access Denied is displayed on all pages accelerated by the cache server.

Related Article

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.