<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Proxy Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/proxy/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/proxy/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Thu, 27 Apr 2023 12:34:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>Proxy Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/proxy/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Reverse Proxy management using Nginx Proxy Manager</title>
		<link>https://serverstadium.com/knowledge-base/reverse-proxy-management-using-nginx-proxy-manager/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Mon, 27 Dec 2021 07:24:00 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=1719</guid>

					<description><![CDATA[<p>Managing proxy hosts can be tedious sometimes. Thanks to its user-friendly web interface, Nginx Proxy Manager allows you to manage your proxy hosts easily and swiftly. However, NPM (Nginx Proxy Manager) currently does not support Load Balancing configuration. But, for basic proxying use cases, this is more than enough! So, let&#8217;s jump on to it,&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/reverse-proxy-management-using-nginx-proxy-manager/">Reverse Proxy management using Nginx Proxy Manager</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Managing proxy hosts can be tedious sometimes. Thanks to its user-friendly web interface, Nginx Proxy Manager allows you to manage your proxy hosts easily and swiftly.</p>



<p class="wp-block-paragraph">However, NPM (Nginx Proxy Manager) currently does not support Load Balancing configuration. But, for basic proxying use cases, this is more than enough! So, let&#8217;s jump on to it, shall we?</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">TLDR Guide</h2>



<ol class="wp-block-list">
<li>Install <code>docker-ce</code> and <code>docker-compose</code></li>
<li>Create new folder <code>npm</code> or <code>nginxproxymanager</code> or anything else.</li>
<li>Save these lines as <code>docker-compose.yaml</code> in the folder</li>
</ol>



<pre class="wp-block-code"><code>version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt</code></pre>



<ol class="wp-block-list" start="4">
<li>Run the stack</li>
</ol>



<pre class="wp-block-code"><code>docker-compose up -d</code></pre>



<ol class="wp-block-list" start="5">
<li>Access the admin UI via <code>http://YOUR-IP:81</code> . Remember, it&#8217;s PORT 81.</li>
<li>Default credentials</li>
</ol>



<pre class="wp-block-code"><code>Email:    admin@example.com
Password: changeme</code></pre>



<ol class="wp-block-list" start="7">
<li>Change the default login.</li>
<li>Enjoy!</li>
</ol>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Prerequisites</h2>



<ol class="wp-block-list">
<li>Port 80, 81, and 443 are allowed on Firewall and Security Profile.</li>
<li>A domain name, at least.</li>
</ol>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Installation Steps</h2>



<p class="wp-block-paragraph">This installation guide would be OS-agnostic as this will run on any system with docker installed.</p>



<p class="wp-block-paragraph">Assuming that <code>docker-ce</code> and <code>docker-compose</code> has been installed on your server. (Otherwise, check out <a href="https://serverstadium.com/knowledge-base/how-to-deploy-portainer/">this article</a> and see only the docker installation part)</p>



<p class="wp-block-paragraph">First, create a docker network with any name you wish:</p>



<pre class="wp-block-code"><code>docker network create proxy_network</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="719" height="91" class="wp-image-1721" src="https://serverstadium.com/wp-content/uploads/2021/12/image.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image.png 719w, https://serverstadium.com/wp-content/uploads/2021/12/image-300x38.png 300w" sizes="(max-width: 719px) 100vw, 719px" />
<figcaption>Create docker network</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Create a folder wherever you like and give it a name:</p>



<pre class="wp-block-code"><code>mkdir /opt/nginx_proxy
cd /opt/nginx_proxy</code></pre>



<p class="wp-block-paragraph">Then, save the following configuration as <code>docker-compose.yaml</code> :</p>



<pre class="wp-block-code"><code>version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

networks:
  default:
    external:
      name: proxy_network</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1722" src="https://serverstadium.com/wp-content/uploads/2021/12/image-1.png" alt="" />
<figcaption>Stack configuration</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">It&#8217;s a very basic configuration that will use SQLite as the database. So, if you wish to use MySQL/MariaDB instead, please use the following, and change the appropriate values:</p>



<pre class="wp-block-code"><code>version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # These ports are in format &lt;host-port&gt;:&lt;container-port&gt;
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db

  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql</code></pre>



<p class="wp-block-paragraph">Then, bring up the stack:</p>



<pre class="wp-block-code"><code>docker-compose up -d</code></pre>



<p class="wp-block-paragraph">Lastly, wait until the process is done.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1724" src="https://serverstadium.com/wp-content/uploads/2021/12/image-3.png" alt="" />
<figcaption>NPM is up and running</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Your NPM (Nginx Proxy Manager) should be accessible via <code>http://YOUR_IP:81</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" class="wp-image-1725" src="https://serverstadium.com/wp-content/uploads/2021/12/image-4.png" alt="" width="623" height="430" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-4.png 830w, https://serverstadium.com/wp-content/uploads/2021/12/image-4-300x207.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-4-768x530.png 768w" sizes="(max-width: 623px) 100vw, 623px" />
<figcaption>NPM login page</figcaption>
</figure>
</div>


<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Initial Setup</h2>



<p class="wp-block-paragraph">On the login page, enter the default NPM credentials as follows:</p>



<pre class="wp-block-code"><code>Email:    admin@example.com
Password: changeme</code></pre>



<p class="wp-block-paragraph">After successfully logging in, a dialog box will show up, and it will let you change the default credentials.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1726" src="https://serverstadium.com/wp-content/uploads/2021/12/image-5.png" alt="" />
<figcaption>Change email address</figcaption>
</figure>
</div>

<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="493" height="403" class="wp-image-1727" src="https://serverstadium.com/wp-content/uploads/2021/12/image-6.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-6.png 493w, https://serverstadium.com/wp-content/uploads/2021/12/image-6-300x245.png 300w" sizes="(max-width: 493px) 100vw, 493px" />
<figcaption>Change default password</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Now, NPM is ready! Yay~</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-1728" src="https://serverstadium.com/wp-content/uploads/2021/12/image-7.png" alt="" width="541" height="371" />
<figcaption>Nginx Proxy Manager dashboard</figcaption>
</figure>
</div>


<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Adding your first proxy host</h2>



<p class="wp-block-paragraph">NPM offers four types of proxy passes. Basic proxy pass called Proxy Hosts, redirection hosts, proxy streaming, and 404 hosts. This article will only cover the Proxy Hosts section, and I leave it to you to discover the rest 😉</p>



<p class="wp-block-paragraph">For your very first proxy host configuration, why don&#8217;t you proxy the NPM dashboard? Accessing it directly via IP: port is ugly! Now, let&#8217;s create it!</p>



<p class="wp-block-paragraph">First, ensure you already create an A record for your domain/subdomain that points to this server via your DNS manager. How to do it depends on your registrar/domain name provider.</p>



<p class="wp-block-paragraph">On the dashboard, click on the Proxy Hosts button. It should show something like this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="683" height="307" class="wp-image-1729" src="https://serverstadium.com/wp-content/uploads/2021/12/image-8.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-8.png 683w, https://serverstadium.com/wp-content/uploads/2021/12/image-8-300x135.png 300w" sizes="(max-width: 683px) 100vw, 683px" />
<figcaption>Add new proxy host</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Click Add Proxy Host. And then, fill in the required fields as follows:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1730" src="https://serverstadium.com/wp-content/uploads/2021/12/image-9.png" alt="" /></figure>
</div>


<p class="wp-block-paragraph">The proxy host is on the same machine, so I prefer to put its private IP. Putting the public IP will work too. Make sure the forwarded port is 81. You can also cache assets, enable WebSockets support, and block common exploits. Here, I will enable the Block Common Exploits.</p>



<p class="wp-block-paragraph">Move to the SSL tab; unless you&#8217;re using Cloudflare SSL (automatically provided by default), you can use LetsEncrypt to generate a valid SSL certificate. And do not forget to enable the options you want.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If you&#8217;re using Cloudflare, do not enable Force SSL option as it will result in redirection loop.</p>
</blockquote>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="477" height="532" class="wp-image-1731" src="https://serverstadium.com/wp-content/uploads/2021/12/image-10.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-10.png 477w, https://serverstadium.com/wp-content/uploads/2021/12/image-10-269x300.png 269w" sizes="(max-width: 477px) 100vw, 477px" /></figure>
</div>


<p class="wp-block-paragraph">Finally, click Save. Your Proxy Hosts page should now list your very first proxy host.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-1732" src="https://serverstadium.com/wp-content/uploads/2021/12/image-11.png" alt="" width="679" height="134" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-11.png 905w, https://serverstadium.com/wp-content/uploads/2021/12/image-11-300x59.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-11-768x152.png 768w" sizes="(max-width: 679px) 100vw, 679px" /></figure>
</div>


<p class="wp-block-paragraph">Now, the moment of truth. Try to access the URL:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-1733" src="https://serverstadium.com/wp-content/uploads/2021/12/image-12.png" alt="" width="654" height="430" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-12.png 872w, https://serverstadium.com/wp-content/uploads/2021/12/image-12-300x197.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-12-768x505.png 768w" sizes="(max-width: 654px) 100vw, 654px" />
<figcaption>It works!</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Hooray, it is working.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">That&#8217;s way too easy, right? Now, you can deploy your own Nginx Proxy Manager using docker-compose and manage your proxy hosts using a simple user interface.</p>



<p class="wp-block-paragraph">For more IT knowledge, you can access it freely in ServerStadium&#8217;s knowledge<a href="https://serverstadium.com/knowledge-base/" target="_blank" rel="noreferrer noopener"> base. </a>Or, for real exciting experience, you can also <a href="https://cp.serverstadium.com/regist-user" target="_blank" rel="noreferrer noopener">sign up</a> in ServerStadium and find out what you can do in our dashboard.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/reverse-proxy-management-using-nginx-proxy-manager/">Reverse Proxy management using Nginx Proxy Manager</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Install and Configure Squid Proxy in Ubuntu</title>
		<link>https://serverstadium.com/knowledge-base/installing-and-configuring-squid-proxy-in-ubuntu/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Fri, 02 Oct 2020 08:48:13 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=437</guid>

					<description><![CDATA[<p>Squid is a full-featured web proxy cache server application that provides proxy and cache services for HTTP, FTP, and other popular network protocols that you can easily install in Ubuntu. This guide will show you how to create your own HTTP proxy using Squid, a highly customizable proxy/cache application, in Ubuntu 18.04 VM Instance in&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/installing-and-configuring-squid-proxy-in-ubuntu/">Install and Configure Squid Proxy in Ubuntu</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="has-text-align-justify wp-block-paragraph">Squid is a full-featured web proxy cache server application that provides proxy and cache services for HTTP, FTP, and other popular network protocols that you can easily install in Ubuntu.</p>



<p class="wp-block-paragraph">This guide will show you how to create your own HTTP proxy using Squid, a highly customizable proxy/cache application, in Ubuntu 18.04 <a href="https://serverstadium.com/knowledge-base/deploying-a-virtual-machine-in-serverstadium/">VM Instance in ServerStadium</a>.</p>



<p class="has-text-align-justify wp-block-paragraph">An HTTP proxy acts as an intermediary between you and the internet. While connected to your Squid HTTP proxy, you will be able to:</p>



<ul class="wp-block-list">
<li>Anonymously access internet services.</li>
<li>Bypass certain regional and local network restrictions.</li>
</ul>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Installing Squid</h2>



<p class="has-text-align-justify wp-block-paragraph">First, make sure the server is up to date by running the following commands as sudo user:</p>



<pre class="wp-block-code"><code>$ sudo apt update &amp;&amp; sudo apt upgrade</code></pre>



<p class="has-text-align-justify wp-block-paragraph">After you ensure your system is up to date, continue with the Squid Installation.</p>



<pre class="wp-block-code"><code>$ sudo apt install squid</code></pre>



<p class="wp-block-paragraph">Then check the installation by using the following command; if the installation succeeded, it will produce this following output:</p>



<pre class="wp-block-code"><code>$ sudo systemctl status squid

Output:
● squid.service - LSB: Squid HTTP Proxy version 3.x
   Loaded: loaded (/etc/init.d/squid; generated)
   Active: active (running) since Thu 2020-09-17 12:06:07 UTC; 4min 46s ago
     Docs: man:systemd-sysv-generator(8)
.....</code></pre>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Configuring Firewalls</h2>



<p class="has-text-align-justify wp-block-paragraph">We should ensure that our Ubuntu VM Instance Squid Port (TCP Port 3128) is not blocked by ServerStadium Security Profile and UFW Firewall.</p>



<p class="wp-block-paragraph">To modify ServerStadium Cloud Security Profile, open the ServerStadium Cloud panel and navigate to <em><strong>Networking Sidemenu -&gt; Security Profile</strong></em>. Then, edit or create a new Security Profile.<br />Add a new Firewall Rule on the Security Profile page that opens TCP port 3128. Then apply the security profile.</p>



<figure class="wp-block-gallery aligncenter has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="505" height="415" data-id="439" class="wp-image-439" src="https://serverstadium.com/wp-content/uploads/2020/09/CP_AddRule.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/CP_AddRule.png 505w, https://serverstadium.com/wp-content/uploads/2020/09/CP_AddRule-300x247.png 300w" sizes="(max-width: 505px) 100vw, 505px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1919" height="495" data-id="444" class="wp-image-444" src="https://serverstadium.com/wp-content/uploads/2020/09/CP_Firewall-1.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/CP_Firewall-1.png 1919w, https://serverstadium.com/wp-content/uploads/2020/09/CP_Firewall-1-300x77.png 300w, https://serverstadium.com/wp-content/uploads/2020/09/CP_Firewall-1-1024x264.png 1024w, https://serverstadium.com/wp-content/uploads/2020/09/CP_Firewall-1-768x198.png 768w, https://serverstadium.com/wp-content/uploads/2020/09/CP_Firewall-1-1536x396.png 1536w" sizes="(max-width: 1919px) 100vw, 1919px" /></figure>
</figure>



<p class="wp-block-paragraph">We also need to ensure Inbound TCP port is allowed in Ubuntu UFW. To do this, run the following command in the Ubuntu VM we installed with Squid server.</p>



<pre class="wp-block-code"><code>$ sudo ufw allow 'Squid'</code></pre>



<p class="wp-block-paragraph">To verify the firewall status, type the following command and the output will be shown below</p>



<pre class="wp-block-code"><code>$ sudo ufw status

Output:
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere                  
Squid                      ALLOW       Anywhere                  
OpenSSH (v6)               ALLOW       Anywhere (v6)             
Squid (v6)                 ALLOW       Anywhere (v6) </code></pre>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Configuring Squid</h2>



<p class="wp-block-paragraph">Now that Squid is installed on our ServerStadium Cloud Ubuntu VM, we can configure it to accept connections and serve as an HTTP proxy.</p>



<p class="wp-block-paragraph">Squid can be configured by editing the <code>/etc/squid/squid.conf</code> file. You can also use separate files with configuration options which can be included using the “include” directive.</p>



<p class="wp-block-paragraph">The configuration file contains comments that describe what each configuration option does.</p>



<p class="wp-block-paragraph">Before making any changes, it is a good practice to back up the original configuration file by running the following commands:</p>



<pre class="wp-block-code"><code>$ sudo cp /etc/squid/squid.conf{,.orginal}</code></pre>



<p class="wp-block-paragraph">Edit the file by opening it using nano (or another text editor):</p>



<pre class="wp-block-code"><code>$ sudo nano /etc/squid/squid.conf</code></pre>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Configuring Client Access via IP ACL</h2>



<p class="wp-block-paragraph">In Squid, you can control how the clients can access the web resources using the Access Control Lists (ACLs).</p>



<p class="wp-block-paragraph">By default, Squid allows access only from the localhost.</p>



<p class="wp-block-paragraph">If all the clients using the proxy have a static IP address, you can create an ACL that includes the allowed IPs.</p>



<p class="wp-block-paragraph">Instead of adding the IP addresses in the main configuration file, we will create a new dedicated file that will hold the IPs:</p>



<pre class="wp-block-code"><code>$ sudo nano /etc/squid/allowSourceIP.txt

192.168.33.1
# All other allowed IPs</code></pre>



<p class="wp-block-paragraph">Once done, open the main configuration file and create a new ACL named <code>allowSourceIP</code> (first highlighted line) and allow access to that ACL using the <code>http_access</code> directive (second highlighted line):</p>



<pre class="wp-block-code"><code># ...
acl allowSourceIP  src "/etc/squid/allowSourceIP.txt"
http_access allow localhost
 #Allow access from localhost
http_access allow allowSourceIP #Allow access from IP List

# And finally deny all other access to this proxy
http_access deny all</code></pre>



<p class="wp-block-paragraph">The <code>http_access</code> directive works similarly to the firewall rules. Squid reads the rules from top to bottom, and when a rule matches, the rules below are not processed.</p>



<p class="wp-block-paragraph">Since the order of <code>http_access</code> rules are important. Make sure you add the line before <code>http_access deny all</code>.</p>



<p class="wp-block-paragraph">Please keep mindful that whenever you make changes to the config file, you need to restart the Squid service with the following command:</p>



<pre class="wp-block-code"><code>$ sudo systemctl restart squid</code></pre>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Configuring Client Access via Basic Authentication</h2>



<p class="wp-block-paragraph">Besides limiting access via IP, we can also configure Squid HTTP proxy via basic HTTP authentication.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<ol class="wp-block-list">
<li>Install htpasswd by installing the Apache utility programs. If you have installed Apache on your Cloudraya Ubuntu VM, you will already have it and can skip this step.</li>
</ol>



<pre class="wp-block-code"><code>$ sudo apt-get install apache2-utils</code></pre>



<p class="wp-block-paragraph">2. Create a file to store Squid users and passwords:</p>



<pre class="wp-block-code"><code>$ sudo touch /etc/squid/squid_usr</code></pre>



<p class="wp-block-paragraph">3. Change ownership of the password file:</p>



<pre class="wp-block-code"><code>$ sudo chown proxy /etc/squid/squid_usr</code></pre>



<p class="wp-block-paragraph">4. Check the location of the <code>ncsa_auth</code> file:</p>



<pre class="wp-block-code"><code>$ sudo dpkg -L squid | grep ncsa_auth</code></pre>



<p class="wp-block-paragraph">5. Edit the Squid configuration file (<code>/etc/squid/squid.conf</code>) and add the following lines at the beginning of the file. Make sure that you update <code>/usr/lib/squid/basic_ncsa_auth</code> below with the location of the <code>ncsa_auth</code> file that you checked in the previous step:</p>
</div></div>



<pre class="wp-block-code"><code>auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/squid_passwd
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users</code></pre>



<p class="wp-block-paragraph">Once you’ve saved and exited the file, complete user removal by restarting Squid:</p>



<pre class="wp-block-code"><code>$ sudo systemctl restart squid</code></pre>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Blocking access to restricted domain</h2>



<p class="wp-block-paragraph">One of the features of Squid proxy server is blocking websites for the client that connects to our Squid Proxy server. It can be done using <code>forbidden dstdomain</code> keyword in <strong>ACL</strong> directive.</p>



<p class="wp-block-paragraph">First, we need to create the file. Then add domain names that we need to restrict:</p>



<pre class="wp-block-code"><code>$ sudo nano /etc/squid/forbidden_domains.txt

Contains:
.facebook.com
.twitter.com
.tiktok.com</code></pre>



<p class="wp-block-paragraph">After we create the list of domains in a text file, we modify the Squid configuration file as follows:</p>



<pre class="wp-block-code"><code># ...
acl allowSourceIP src "/etc/squid/allowSourceIP.txt"

#Add a new ACL directive
acl forbidden dstdomain "/etc/squid/forbidden_domains" 

http_access allow localhost
 #Allow access from localhost
http_access allow allowSourceIP #Allow access from IP List
#Add the restricted server in the deny list
http_access deny forbidden

# And finally deny all other access to this proxy
http_access deny all</code></pre>



<p class="wp-block-paragraph">After that, don&#8217;t forget to restart the Squid service to apply the changes</p>



<pre class="wp-block-code"><code>$ sudo systemctl restart squid</code></pre>



<p class="wp-block-paragraph">&nbsp;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Anonymizing Traffic</h2>



<p class="wp-block-paragraph">We also can anonymize clients that connect to our Squid proxy. Thus, IP address of the clients that connects to our Squid proxy will not be forwarded to servers that receive traffic from our Squid Proxy.</p>



<p class="wp-block-paragraph">This is done via the rules below. Add the following lines at the beginning of the Squid configuration file:</p>



<pre class="wp-block-code"><code>forwarded_for off
request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all</code></pre>



<p class="wp-block-paragraph">After that, close the config file and restart your Squid proxy.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Connecting to your Squid Proxy</h2>



<p class="wp-block-paragraph">Your Squid Proxy Server is now ready, Congratulations!</p>



<p class="wp-block-paragraph">You can configure your local browser or operating system’s network settings to use your ServerStadium VM as an HTTP proxy. The settings to do this will vary depending on your OS and browser.</p>



<p class="wp-block-paragraph">You may find several official articles below to configure your Client OS or Browser to connect to the Squid Proxy:</p>



<ul class="wp-block-list">
<li><a href="https://docs.microsoft.com/en-us/windows/security/threat-protection/microsoft-defender-atp/configure-proxy-internet">Configure Proxy on Windows</a></li>
<li><a href="https://support.apple.com/en-in/guide/mac-help/mchlp2591/mac">Proxy Server Settings on macOS</a></li>
<li><a href="https://support.mozilla.org/en-US/kb/connection-settings-firefox">Connection Settings in Firefox</a></li>
</ul>
<p>The post <a href="https://serverstadium.com/knowledge-base/installing-and-configuring-squid-proxy-in-ubuntu/">Install and Configure Squid Proxy in Ubuntu</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
