Quickly build squid servers with Amazon free cloud hosting and Docker technology!

Source: Internet
Author: User
Tags cloud hosting hosting docker cp docker hub docker run aws console

First of all, to apply for Amazon EC2, the specific steps are not verbose, unfamiliar classmates can refer to the following steps (Amazon website has detailed online instructions).

  • Account Registration

  • Bundled credit cards: This is a must-have process, but does not require a fee.

  • Access AWS Console:https://console.aws.amazon.com 

    < Span class= "S1" in the main web panel click Compute EC2

    Select host Mirror

    Select the type of instance, here we select the first: Free tier Eligible, do not choose other, otherwise lead to pay

    configuration instance details, it is important to note that the Auto-assign public IP parameters must be enable , otherwise your VM is no extranet IP can not be remote and internet

    add storage, here Amazon hint can be promoted to 30GB storage, I use the default is enough

    definition instance label

    Configure security groups (in which a group defines some restrictions or port policies), Here are 2 ports to open:

       -  SSH Protocol 22 ports: for our remote configuration and management

    P class= "P1" >   -  HTTP Proxy service using 3128 port (default)

    Create a key pair and download the private key certificate

  • Select Download to local private key certificate above, connect with Xshell (Linux) or putty (Windows)


Below we enter the topic, how in 5 minutes time to complete the Squid Agent service construction.

First, use the pull command to download a mature squid image from the Docker hub

Docker Pull Sameersbn/squid:latest

Second, start the container

Docker run--name squid-d--restart=always--publish 3128:3128--volume/srv/docker/squid/cache:/var/spool/squid3 Same Ersbn/squid:latest

C. Copy the configuration file from the container to the host (you can also use the Attach method to directly go to the container to modify the relevant configuration file before consuming the commit command persisted to the mirror, but this is not recommended from a post-maintenance perspective)

Docker CP squid:/etc/squid3/.

Iv. Modify the configuration files that have been copied to the host (set access permissions, etc.), and modify the minimum one.

VI squid.conf # and finally deny all other access to this proxy http_access allow all # Modify the Deny all here to allow Al L

Five. After stopping and deleting a running container, restart it in the same way that the volume binds the host profile

Docker Stop Squiddocker RM squiddocker run--name squid-d--restart=always--publish 3128:3128--volume/srv/docker/s QUID/CACHE:/VAR/SPOOL/SQUID3--VOLUME/HOME/EC2-USER/SQUID/SQUID3:/ETC/SQUID3 Sameersbn/squid:latest

Six, now a private HTTP proxy server has been set up, modify the browser's access settings can be used directly.

Export FTP_PROXY=HTTP://{EC2 Cloud host Ip}:3128export http_proxy=http://{ec2 Cloud host Ip}:3128export https_proxy=http:// {EC2 Cloud host ip}:3128


Other:

A, using the way to clear the container at exit start:

sudo docker run--name squid--rm--publish 3128:3128--volume/srv/docker/squid/cache:/var/spool/squid3--volume/home /EC2-USER/SQUID/SQUID3:/ETC/SQUID3 Sameersbn/squid:latest

B. View the proxy access log:

sudo docker exec-it squid tail-f/var/log/squid3/access.log

C. Accessing and entering a running container

sudo docker exec-it squid bash



Quickly build squid servers with Amazon free cloud hosting and Docker technology!

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.