Install apache
yum install httpd setroubleshoot-server
Edit Konfigurasi apache
vi /etc/httpd/conf/httpd.conf
Edit pada bagian listen
Listen 3128
Ubah Konfigurasi di httpd.conf dari
IncludeOptional conf.d/*.conf
Diubah menjadi Caching proxy
IncludeOptional conf.d/proxy.conf
Buat konfigurasi baru untuk proxy
vi /etc/httpd/conf.d/proxy.conf
Masukkan Konfigurasi Berikut
################################################################## ############### Konfigurasi HTTP Proxy ESET #################### # # Enable HTTP Cache # CacheEnable disk http:// CacheDirLevels 4 CacheDirLength 2 CacheDefaultExpire 3600 CacheMaxFileSize 200000000 CacheMaxExpire 604800 CacheQuickHandler Off CacheRoot /var/cache/httpd/proxy #ProxyRemote * http://user_proxy:password_proxy@IPSERVERPROXY:3128 ProxyRequests On ProxyVia On SetEnv proxy-initial-not-pooled 1 ErrorLog "|/usr/sbin/rotatelogs -n 10 /var/log/httpd/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 ######################### ##################################################################
Add port 3128 di selinux apache (silakan di skip jika selinux di disable)
semanage port -m -t http_port_t -p tcp 3128
Open Port Firewall(silakan skip jika tidak terinstall)
firewall-cmd --zone=public --add-port=3128/tcp --permanent
Set Agar Apache bisa konek ke Proxy internal
setsebool httpd_can_network_connect 1
atau
setsebool httpd_can_network_connect true
Restart apache service:
systemctl restart httpd
Jalankan Perintah berikut
echo /usr/sbin/apachectl start >> /root/http-forward-proxy.sh echo /usr/sbin/htcacheclean -d 60 -i -p /var/cache/httpd/proxy -l 10000000000 >> /root/http-forward-proxy.sh chmod +x /root/http-forward-proxy.sh bash /root/http-forward-proxy.sh
Masukkan ke crontab dengan mengetik perintah berikut
crontab -e
Ketik perintah berikut
@reboot bash /root/http-forward-proxy.sh
Test proxy
wget www.google.com -e use_proxy=yes -e http_proxy=IP_PROXY_CENTOS7:3128
Jika Error seperti berikut
-- 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 apa saja yang telah di cache Apache Proxy bisa memakai command berikut
/usr/sbin/htcacheclean -a -p /var/cache/httpd/proxy/