Difference between revisions of "Apache: Tomcat Install"

From OnnoWiki
Jump to navigation Jump to search
 
Line 67: Line 67:
  
  
===Security===
+
==Security==
  
 
Jika hanya ingin menggunakan Manager Applikasi saja, maka pada direktori WebApp, Folder yang bernama docs, example, bisa di hapus.
 
Jika hanya ingin menggunakan Manager Applikasi saja, maka pada direktori WebApp, Folder yang bernama docs, example, bisa di hapus.
 +
 +
 +
Edit conf
 +
 +
<Server port="8005" shutdown="SHUTDOWN">
 +
Bisa di ubah menjadi
 +
<Server port="8867" shutdown="NOTGONNAGUESS">
 +
 +
Tambahkan
 +
 +
<Valve className="org.apache.catalina.valves.AccessLogValve"
 +
directory="logs"
 +
prefix="localhost_access_log."
 +
suffix=".txt"
 +
pattern="common" resolveHosts="false"/>
 +
 +
Cek folder log, ada file localhost_access_log
  
 
==Referensi==
 
==Referensi==

Latest revision as of 04:03, 30 July 2020

Sumber: https://linuxconfig.org/ubuntu-20-04-tomcat-installation

Apache Tomcat is an HTTP server that can run Java technologies, namely Java Servlet, JavaServer Pages (JSP), and Java Expression Language.


Instalasi

sudo apt update
sudo apt-cache search tomcat
sudo apt install tomcat9 tomcat9-admin

cek port 8080

ss -ltn

Enable/Disable Tomcat

sudo systemctl enable tomcat9
sudo systemctl disable tomcat9

Buka Filewall Port 8080

sudo ufw allow from any to any port 8080 proto tcp

Test

Browse ke

http://127.0.0.1:8080
http://ip-address-server:8080


Create user for Web Application Manager

sudo vi /etc/tomcat9/tomcat-users.xml
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>


<tomcat-users>
<user username="devusion" password="dev123" roles="manager-gui, admin-gui" />

Contoh

<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="tomcat" password="pass" roles="admin-gui,manager-gui"/>



restart

sudo systemctl restart tomcat9

Access Tomcat Web Application Manager

http://127.0.0.1:8080/manager/html
http://ip-address-server:8080/manager/html


Security

Jika hanya ingin menggunakan Manager Applikasi saja, maka pada direktori WebApp, Folder yang bernama docs, example, bisa di hapus.


Edit conf

<Server port="8005" shutdown="SHUTDOWN">

Bisa di ubah menjadi

<Server port="8867" shutdown="NOTGONNAGUESS">

Tambahkan

<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" 
prefix="localhost_access_log."
suffix=".txt"
pattern="common" resolveHosts="false"/>

Cek folder log, ada file localhost_access_log

Referensi

Pranala Menarik