Tutorials Build Server #3 || How to Configure Proxy Server to Blocked Porn Website || Bagaimana cara mengkonfigurasikan proxy server untuk memblokir situs porno

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@fandimuhammad11·
0.000 HBD
Tutorials Build Server #3 || How to Configure Proxy Server to Blocked Porn Website || Bagaimana cara mengkonfigurasikan proxy server untuk memblokir situs porno
![13.jpg](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515824853/mq02hegmoxf3wtafam4n.jpg)


**What is a Proxy Server..?**
proxy server is a server computer that provides a service to forward any user requests to other servers contained on the internet and has a role as a liaison between a computer with the internet.
In addition, the proxy can also be used for Security, such as blocking access to a website.

**How Do Proxy Servers Work?**

The proxy server works by receiving requests from internal clients and sending them to the external network as if it were the client proxy itself. When a proxy server receives a response and a public server, it responds to the original client as if it were a public server. For Proxy Server configuration that can use the most popular and powerful applications SQUID. Here's how to configure SQUID.

**Installation of Squid**

The first step we have to do is to install the squid package that will be used for the proxy server, can use the command:
> apt–get install squid

![2.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515817639/qqfs9ffnydswqmrwzrxv.png)

Next we can do squid configuration process by using command:
> nano /etc/squid/squid.conf

![3.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515817705/wwau9i70zcigw9dtt3kn.png)

In order to facilitate the configuration we can use the search facility (**Ctrl + W**) that is by searching the script on the squid file.

The first, search script **http_port 3128** add "transparent" and remove the "#".
How to use the command **ctrl + w** (search) then type the script to be searched:
> http_port 3128

![4.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515817980/fmzqxd5r4gw56c2cetda.png)

Then this view after we edit by add to "**transparent**" and remove the "**#**"  can use the command:
> http_port 3128 transparent

![6.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515818290/bagw4ldqafbtmexddw6k.png)

The second, look for script **cache_mem 8 mb** then remove "**#**" to become enable.
how to use the command **ctrl + w** (search) then type the script to be searched:
> cache_mem 8 mb

![7.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515818466/qxy2bprxcvn6da71gmsa.png)

then edit like this view and remove to "**#**".

![9.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515818666/zmojoi4nm6emwwqywp4n.png)

The third,  search cache_mgr script then remove "**#**" and add web identity or admin email address.
how to use the command **ctrl + w** (search) then type the script to be searched :
> cache_mgr

![10.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515819777/qpvk7lcwmqrramm0x3tr.png)

then edit and add web identity or admin email address. with the command:
> cache_mgr fandimuhammad11@gmail.com

![12.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515820003/a902nl9l2ka6ihw1na1t.png)

the fourth,  search the **acl CONNECT** script and add a Script like this:
how to use the command **ctrl + w** (search) then type the script to be searched:
> acl_CONNECT

![13.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515820096/ijroqdyvpi1zydmwj4ym.png)

then edit it into something like this by adding some source code, like this picture:

> acl url dstdomain “/etc/squid/url”
acl key url_regex –i “/etc/squid/url”
http_access deny url
http_access deny key
acl lan src 192.168.100.0/24
http_access allow lan
http_access allow all

![15.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515820142/argise24ekaynvjbegdg.png)

the fifth section look for the script http_access deny all, then there are two similar scripts on the file :  **squid.conf**. How to use the command **Ctrl + w **(search) and to add "**#**" for package disabled
Then type the script to be searched :
> http_access deny all

![16.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515820610/ue4nzxfk9laezzezbiqy.png)

The 1st script :
![17.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515820625/xerxahbhzwu7aknmjwmf.png)

The 2nd script :

![20.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515820701/i3fswsub8riox5qmgl6g.png)

After we configure and save with command **Ctrl+X > Save > Enter** 

**Configure to Block website**

Blocking the website the first step to do is create a file to register the sites and words to be blocked.
The trick can be done by logging into the squid directory with the command :
> cd / etc/squid

![23.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515821098/vf2p3x9fyxofrplzc8ak.png)

Then go into the file **url** , using the command :
> nano url

![24.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515821155/lfyfxqdqoxevj0lgptzg.png)

then we add any sites we want to block as an example :
 we will block porn websites .

> porn.com
xxx.com

![25.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515821267/s5klzaqhdufjzr0mxj4z.png)

After we configure and save with command **Ctrl+X > Save > Enter** .
Then go into the file **key**, using the command: 
> nano key

![27.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515821368/dsp0o0xns9nhakh71y3j.png)

then on this key file we enter any keywords that will be in block:
> porn
xxx

![28.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515821588/i1zflorocvoawusuzzwz.png)
After we configure and save with command **Ctrl+X > Save > Enter** .

then to check whether the configuration is correct or not we can use the command :
> squid –z

 ![31.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515821675/ve1g4qiqqkyvzab9mtjv.png)

if it appears squid is **already running! process ID 1180**, then the configuration process is correct.

**Configuration IP Tables**

Then we configure it on iptables, to redirect port 80 (**HTTP**) to port 3128 (**PROXY**).
then enter into **/etc/rc.local** file, using command:
> nano /etc/rc.local

![32.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515821912/boof7q8h7ih60smpi8ro.png)
 
then we add the source code to the file **/etc/rc.local** :
> iptables –t nat –A PREROUTING –s 192.168.10.0/24 –p tcp --dport 80 –j REDIRECT --to-port 3128 

![34.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515822068/lvrikj018jsh2vctdwdl.png)

After we configure and save with command **Ctrl+X > Save > Enter** . 
Finally, restart the squid we have configured before we test.
**/etc/init.d/squid restart**

![36.PNG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515822249/osm3ppj1rzpw457yqfau.png)

**Testing Proxy**

Testing we do on the client side windows. The Proxy server will become **TRANSPARENT** if there is a connection to the Internet.
But if used in the scope of **Local Area Network (LAN)**, which is not the Internet, then we must configure **MANUAL PROXY** on the client side first .

Manual Proxy Configuration :
Here's how to configure Manual Proxy in **Mozilla Firefox Web Browser**.
> Options -> General-> Network proxy -> Settings

![37.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515823250/uvb3dgns8qktqnrcpifu.png)

then after we mengaktikan proxy manual, then we fill in the address we have created earlier whether blocked or not when it appears **ERROR the requested URL could not be received**.

**porn sites have been successfully blocked.**

![91.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515823898/mkq3kox9rrvhxbful4yw.png)

![90.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1515823748/qzdnpor012gwzegfixls.png)

**note :**

before testing make sure your computer is connected to the server.

if the site has not been successfully blocked check the proxy configuration again


















<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@fandimuhammad11/tutorials-build-server-3-or-or-how-to-configure-proxy-server-to-block-porn-website-or-or-bagaimana-cara-mengkonfigurasikan-proxy">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍 , , , , ,