Ini melanjutkan khayalan 1 bulan yang lalu. Kali ini installasi Squid Proxy yang difungsikan sebagai reverse proxy. Mari kita melanjutkan khayalannya. Anggap saja kita mempunyai 2 layanan pada domain yang berbeda misal negeridiawan.com dan pangeranawan.com. Domain negeridiawan.com dipetakan atau dibuat mesin virtual dengan IP Address 192.168.37.11 dan pangeranawan.com dengan IP Address 192.168.37.12. Setting IP Address di virtual mesin saya anggap Anda sudah paham, begitu pula installasi server dan konfigurasi DNS. Kalau Anda masih bingung bisa mencari dengan kata kunci Setting IP Ubuntu, DNS Ubuntu, Install Server Ubuntu, dan sebagainya.
Installasi Squid Proxy cukup ketik, sudo apt-get install squid. Konfigurasi Squid Proxy yang lama disimpan saja menggunakan perintah sudo mv /etc/squid/squid.conf /etc/squid/squid.conf.ori. Selanjutnya Anda membuat berkas /etc/squid/squid.conf yang isinya kurang lebih seperti dibawah ini.
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl valid_domains dstdomain .negeridiawan.com
acl valid_domains dstdomain .pangeranawan.com
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow valid_domains
http_access deny all
icp_access deny all
http_port 80 vhost vport
cache_peer 192.168.37.11 parent 80 0 no-query originserver name=negeridiawan
cache_peer 192.168.37.12 parent 80 0 no-query originserver name=pangeranawan
cache_peer_domain negeridiawan negeridiawan.com
cache_peer_domain pangeranawan pangeranawan.com
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log common
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
Jangan lupa untuk restart layanan Squid Proxy, sudo /etc/init.d/squid restart. Anda bisa melakukan ujicoba dengan menginstall web server pada masing-masing mesin virtual. Semoga berhasil dan terwujud mimpi kita.
Referensi :
Comments
Post a Comment