Install Apache Proxy di Debian

You are here:

Install apache

apt install apache2 apache2-utils

Aktifkan module Apache berikut

a2enmod access_compat auth_basic authn_core authn_file authz_core authz_groupfile authz_host proxy proxy_http proxy_connect cache cache_disk

Edit Konfigurasi Port Apache

vi /etc/apache2/ports.conf

Edit pada bagian listen

Listen 3128

Edit Konfigurasi Apache untuk Cache :

vi /etc/apache2/mods-available/cache_disk.conf

Beri tanda pagar untuk konfigurasi sebelumnya dan masukkan konfigurasi Berikut sebelum bagian

##################################################################
#################  Konfigurasi Cache ESET  #######################

#
# Enable HTTP Cache
#
CacheEnable disk http://
CacheDirLevels 4
CacheDirLength 2
CacheDefaultExpire 3600
CacheMaxFileSize 200000000
CacheMaxExpire 604800
CacheQuickHandler Off
CacheRoot /var/cache/apache2/mod_cache_disk

################### End Of Configuration #########################
##################################################################

Edit Konfigurasi Apache Proxy

vi /etc/apache2/mods-available/proxy.conf

Masukkan Konfigurasi Berikut sebelum bagian

##################################################################
###############  Konfigurasi HTTP Proxy ESET  ####################

#ProxyRemote * http://user_proxy:password_proxy@IPSERVERPROXY:3128

ProxyRequests On
ProxyVia On

SetEnv proxy-initial-not-pooled 1

ErrorLog "|/usr/bin/rotatelogs -n 10 /var/log/apache2/error_log 1M"


Deny from all

#*.eset.com:

Allow from all

#*.eset.eu:

Allow from all

#Antispam module (ESET Mail Security only):

Allow from all

#Services (activation)

Allow from all

#ESET servers accessed directly via IP address:

Allow from all


################### End Of Configuration #########################
##################################################################

Restart apache service

service apache2 restart

Edit Konfigurasi htcacheclean Apache

vi /etc/default/apache2

Edit size dan interval htcacheclean

HTCACHECLEAN_SIZE=10000M
HTCACHECLEAN_DAEMON_INTERVAL=60

Start apache-htcacheclean service

service apache2 start-htcacheclean

Test proxy

wget www.google.com -e use_proxy=yes -e http_proxy=IP_ERA_SERVER:3128

Jika Error

--  http://www.google.com/

           => 'index.html'

Connecting to YourDearERAServer:3128... connected.

Proxy request sent, awaiting response... 403 Forbidden

15:05:34 ERROR 403: Forbidden.

Maka proxy telah jalan
Untuk mengecek yang telah di cache Apache Proxy

htcacheclean -a -p /var/cache/apache2/mod_cache_disk