0% found this document useful (0 votes)
77 views

Reverse Proxy Apache: Instalasi Dan Seting Front Web Server

The document discusses setting up reverse proxying on Apache web server. It involves installing Apache and enabling proxy modules. Virtual hosts are configured for subdomains a.test.konfigurasi, b.test.konfigurasi and c.test.konfigurasi to proxy to different backend servers. The subdomain records are then added to the Mikrotik router/DNS server. Testing shows the subdomains resolving to the Apache server IP and proxying to the respective backends.

Uploaded by

Iwanovic
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Reverse Proxy Apache: Instalasi Dan Seting Front Web Server

The document discusses setting up reverse proxying on Apache web server. It involves installing Apache and enabling proxy modules. Virtual hosts are configured for subdomains a.test.konfigurasi, b.test.konfigurasi and c.test.konfigurasi to proxy to different backend servers. The subdomain records are then added to the Mikrotik router/DNS server. Testing shows the subdomains resolving to the Apache server IP and proxying to the respective backends.

Uploaded by

Iwanovic
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Reverse Proxy Apache

Hi…

Kali ini kita akan coba reverse proxy pada apache2. Lab kali ini didasari dari tugas kantor (hahaha… lagi-
lagi karena dapet tugas kantor).

Jadi dikantor sudah ada banyak web server, dengan IP berbeda-beda. Dan beberapa akan mempunyai
subdomain yang dapat diakses dari internal kantor maupun dari public.

Topologinya kurang lebih seperti ini, masih menggunakan IP private. Nanti silahkan coba sendiri apabila
ingin pasang IP Public

DNS server jadi satu dengan Router dimana menggunakan Mikrotik, dan sudah pernah dibahas disini.

Instalasi dan Seting Front Web Server

Update dan upgrade repository


root@ubuntu:/home/ubuntu#apt update && apt upgrade –y

Install apache2 dan build essential


root@ubuntu:/home/ubuntu#apt install build-essential apache2

Enable mod proxy untuk apache2


root@ubuntu:/home/ubuntu#a2enmod proxy proxy_http proxy_html
Set reverse proxy sub domain a.test.konfigurasi

Copy default.conf ke a.conf


root@ubuntu:/home/ubuntu#cd /etc/apache2/sites-available/

root@ubuntu:/etc/apache2/sites-available#cp 000-default.conf cacti.conf

Edit a.conf, sesuaikan dengan nama subdomain dan ip webserver


root@ubuntu:/etc/apache2/sites-available# nano a.conf

<VirtualHost *:80>

# The ServerName directive sets the request scheme, hostname and port t$

# the server uses to identify itself. This is used when creating

# redirection URLs. In the context of virtual hosts, the ServerName

# specifies what hostname must appear in the request's Host: header to

# match this virtual host. For the default virtual host (this file) this

# value is not decisive as it is used as a last resort host regardless.

# However, you must set it for any further virtual host explicitly.

ServerName a.test.konfigurasi

ServerAdmin webmaster@localhost

#DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,

# error, crit, alert, emerg.

# It is also possible to configure the loglevel for particular

# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

ProxyPreserveHost On

# Servers to proxy the connection, or

# List of application servers Usage

ProxyPass / http://192.168.192.2:80/

ProxyPassReverse / http://192.168.192.2:80/

# For most configuration files from conf-available/, which are

# enabled or disabled at a global level, it is possible to

# include a line for only one particular virtual host. For example the

# following line enables the CGI configuration for this host only

# after it has been globally disabled with "a2disconf".

#Include conf-available/serve-cgi-bin.conf

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Ulangi langkah copy dan edit a.conf untuk b.conf dan c.conf, tentunya disesuaikan dengan nama
subdomain dan IP masing-masing.

Selanjutnya, enable a.conf, b.conf dan c.conf


root@ubuntu:/etc/apache2/sites-available# a2ensite a.conf
Enabling site a.

To activate the new configuration, you need to run:

service apache2 reload

root@ubuntu:/etc/apache2/sites-available# a2ensite b.conf

Enabling site b.

To activate the new configuration, you need to run:

service apache2 reload

root@ubuntu:/etc/apache2/sites-available# a2ensite c.conf

Enabling site c.

To activate the new configuration, you need to run:

service apache2 reload

Selanjutnya restart service apache


root@ubuntu:/etc/apache2/sites-available# service apache2 reload

Menambahkan subdomain pada Router/DNS Server

Setelah front dan backend web sudah siap, sekarang akan menambahkan atau pointing IP front web server
ke masing-masing sub domain di Router MikroTik
Test ping dulu
C:\Users\konfigurasi.net>ping a.test.konfigurasi

Pinging a.test.konfigurasi [172.30.0.58] with 32 bytes of data:

Reply from 172.30.0.58: bytes=32 time=13ms TTL=64

Reply from 172.30.0.58: bytes=32 time=2ms TTL=64

Reply from 172.30.0.58: bytes=32 time=1ms TTL=64

Reply from 172.30.0.58: bytes=32 time=4ms TTL=64

Ping statistics for 172.30.0.58:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 1ms, Maximum = 13ms, Average = 5ms


C:\Users\konfigurasi.net>ping b.test.konfigurasi

Pinging b.test.konfigurasi [172.30.0.58] with 32 bytes of data:

Reply from 172.30.0.58: bytes=32 time=1ms TTL=64

Reply from 172.30.0.58: bytes=32 time=2ms TTL=64

Reply from 172.30.0.58: bytes=32 time=2ms TTL=64

Reply from 172.30.0.58: bytes=32 time=6ms TTL=64

Ping statistics for 172.30.0.58:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 1ms, Maximum = 6ms, Average = 2ms

C:\Users\konfigurasi.net>ping c.test.konfigurasi

Pinging c.test.konfigurasi [172.30.0.58] with 32 bytes of data:

Reply from 172.30.0.58: bytes=32 time=2ms TTL=64

Reply from 172.30.0.58: bytes=32 time=2ms TTL=64

Reply from 172.30.0.58: bytes=32 time=4ms TTL=64

Reply from 172.30.0.58: bytes=32 time=2ms TTL=64

Ping statistics for 172.30.0.58:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),


Approximate round trip times in milli-seconds:

Minimum = 2ms, Maximum = 4ms, Average = 2ms

Sekarang coba buka di web browser

You might also like