How to Create an HTTP Proxy Using Squid on CentOS 7

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Marin Todorov

I am a bachelor in computer science and a Linux Foundation Certified System Administrator. Currently working as a Senior Technical support in the hosting industry. In my free time I like testing new software and inline skating.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

20 Responses

  1. Amin Vakil says:

    I’ve facing a problem from two days ago connecting to telegram via my squid proxy.

    There is more explanation in the link below:
    https://github.com/telegramdesktop/tdesktop/issues/5437

  2. zee says:

    Hello Sir, your tutorial is very good i have question sir kindly help i want to configure squid with https so kindly help me thanks.

  3. David Tua says:

    Why is my new installed squid proxy is so slow browsing the internet and I have no idea why? Computer specs (Intel i5 Processor, 8GB Memory, 500GB HDD)

  4. Robby Sherrif says:

    If you put the IP address of the Centos machine in a browser it will show the index.html file, which is fine. I want to change it so that if I type intranet in the browser it shows the index.html file.

    Any idea how? Thanks!

  5. Cesar Martinez says:

    @Admin
    But for this configuration use a certificate that you must issue on the server, this does not go against the citations issued by each website?

    • Ravi Saive says:

      @Cesar,

      I really never tried with HTTPS blocking on squid, so I have no idea about it. But I think there must be a way to block HTTPS website, let me look into this..

  6. Amin Vakil says:

    @Ravi,

    I can’t reply anymore so I’m opening another answer, I had already done that, could you please check my configuration: https://pastebin.com/JUpF73Mb

    • Ravi Saive says:

      @Amin,

      The squid configuration seems perfect, but it’s all Google’s new features which is blocking Youtube vidoes from caching.

  7. Cesar Martinez says:

    @Admin

    It does not block squid https since it does not block anything that passes through port 443, iptables must be used. I tried Facebook with YouTube and it does not filter

  8. Prakash Naikade says:

    What if I want to block particular website for particular time duration ?

    • Ravi Saive says:

      @Prakash,

      Yes, you can block any website for specific time using ACL, for example here I am restricting access to facebook for specific hours of the day with squid i.e. in morning 08:00-09:00.

      acl facebooktime time MTWHF 09:00-10:00
      acl FBDomain  dstdomain .facebook.com
      http_access allow FBDomain facebooktime
      http_access deny  FBDomain
      
  9. Cesar Martinez says:

    Excellent post, but how can you block access to https sites with squid.

    • Ravi Saive says:

      @Cesar,

      Just place the domain names in the /etc/squid/blacklisted_sites.acl file that you want to block whether it HTTP or HTTPS, everything is blocked..

  10. Amin Vakil says:

    I’ve setup my squid a while ago on ubuntu 16.04 and recently on centos 7 just like this article says.

    I have problems with few websites like telegram.org & youtube.com, they’re just these two, although I can curl both websites but I cannot view them via squid.

    What am I missing?

    • Ravi Saive says:

      @Amin,

      I know about this issue since very long time, squid proxy doesn’t play Youtube videos, due to its several ‘features’ that prevent their flash videos being effectively distributed by caches.

      You should check this article for solution – http://wiki.squid-cache.org/ConfigExamples/DynamicContent/YouTube

      • Amin Vakil says:

        @Ravi,

        It didn’t work out for me, also at the top of page is written:

        {X} {X} {X} Google\YouTube changed their system to be more secure and due to this the article in it’s current state is not applicable. You will need to use Content Adaptation to achive YT caching and it’s not a beginne’s task.

        • Ravi Saive says:

          @Amin,

          Try this trick, hope it work..

          Open your squid configuration file and search for dns_v4_first off and change it to dns_v4_first on.

          Restart squid and it should work now.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.