1. Pastikan SELinux izinkan port 8183 (atau port yang akan digunakan)
$ getenforce
-Kalau hasilnya Enforcing, jalankan:
$ sudo dnf install policycoreutils-python-utils -y
$ sudo semanage port -a -t http_port_t -p tcp 8183
2. Konfigurasi Nginx sebagai web server di port 8183
-Buat file /etc/nginx/conf.d/myserver.conf:
server {
listen 8183;
listen [::]:8183;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
3. Tambah <pre>Reverse Proxy Sukses</pre> di halaman HTML Nginx
-Edit file /usr/share/nginx/html/index.html
-Cari tag <h2>Nama Kalian</h2> lalu langsung di bawahnya tambahkan:
<pre>Reverse Proxy Sukses</pre>
4. Restart Nginx
$ sudo nginx -t
$ sudo systemctl restart nginx
5. Konfigurasi Apache sebagai reverse proxy ke Nginx port 8183
-Buat file /etc/httpd/conf.d/reverse-proxy.conf:
<VirtualHost *:80>
ServerName localhost
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8183/
ProxyPassReverse / http://127.0.0.1:8183/
ErrorLog /var/log/httpd/reverse-proxy-error.log
CustomLog /var/log/httpd/reverse-proxy-access.log combined
</VirtualHost>
6. Restart Apache
$ sudo systemctl restart httpd
7. Cek port
$ sudo ss -tuln | grep :80
$ sudo ss -tuln | grep :8183
8. Tes akses via browser ke port 80
http://IP-SERVER
-Kamu akan melihat halaman Nginx dengan teks:
Nama Kalian
Reverse Proxy Sukses
Tidak ada komentar:
Posting Komentar