Set up proxy server on your google compute engine via squid

Install squid
    sudo apt install squid3
   
Install apache utils
    sudo apt-get install apache2-utils
    This Installs the htpasswd utility that allows for creating password files.
   
Copy the default configuration file to back it up.
    This configuration file is ridiculously huge and has way more than any simple case would need.  We will just back it up and make a new one with only the information that we need.
    sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.original
       
Delete the old configuration file
    sudo rm /etc/squid/squid.conf

Make a new configuration files
    sudo vi /etc/squid/squid.conf
   
Enter this in the config file
    auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
    auth_param basic realm proxy
    acl authenticated proxy_auth REQUIRED
    http_access allow authenticated

    # Choose the port you want. Default is 3128, but we set it to 7777
    http_port 7777
    The first bit (4 lines) sets squid to require passwords
    The last bit configures squid to use port 7777.  You can change this to anything you want.
    Save the file in vi with [esc]:wq
   
Set up the username and password
    sudo htpasswd -c /etc/squid/passwords [username]
    Replace [username] with any username you want to use
    You will be asked to enter and reenter a password for the username that you entered.  make sure they match.
   
Restart the squid service
    sudo systemctl restart squid.service

The last step, please not forget to set up a new firewall rule for http_port




No comments:

Post a Comment

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...