Tomcat 서버 설치하기
wget https://archive.apache.org/dist/tomcat
/tomcat-9/v9.0.91/bin/apache-tomcat-9.0.91.tar.gz
tar -zxvf apache-tomcat-9.0.91.tar.gz
sudo mv apache-tomcat-9.0.91 /usr/local/lib/
sudo mv /usr/local/lib/apache-tomcat-9.0.91/ /usr/local/lib/tomcat
... 아래에
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto
CATALINA_HOME=/usr/local/lib/tomcat
PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
export JAVA_HOME
export CATALINA_HOME
export LANG=ko_KR.UTF-8
sudo /usr/local/lib/tomcat/bin/startup.sh
ss -antlp | grep 8080
netstat -antup | grep 8080
sudo /usr/local/lib/tomcat/shutdown.sh
8080 호스트 포트
게스트 ip : 192.168.15.102
게스트 포트 : 8080
myserver02에서 설정할 내용
$sudo visudo
#Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) NOPASSWD: ALLa
myserver01에서 myserver02에게 파일 전송 및 명령어 실행
user1@myserver01:~/springex$ scp -i ~/.ssh/id_rsa ./build/libs/springex-1.0-SNAPSHOT.war
user1@192.168.15.102:~/app.war
springex-1.0-SNAPSHOT.war 100% 20MB 42.1MB/s 00:00
cd
user1@myserver01:~/springex$ ssh -i ~/.ssh/id_rsa
user1@192.168.15.102 sudo mv app.war /usr/local/lib/tomcat/webapps/
user1@myserver01:~/springex$ ssh -i ~/.ssh/id_rsa user1@192.168.15.102 sudo /usr/local/lib/tomcat/bin/shutdown.sh
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED -
-add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
user1@myserver01:~/springex$ ssh -i ~/.ssh/id_rsa user1@192.168.15.102 sudo /usr/local/lib/tomcat/bin/startup.sh
프록시 설정 : Nginx
sudo apt-get-update
sudo apt install nginx -y
user1@myserver02:~$ sudo vim /etc/nginx/sites-available/default
...
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
proxy_pass http://localhost:8080;
}
...