/usr/local/tomcat
디렉토리를 홈 디렉토리로 설정-M
옵션으로 디렉토리 미 생성-s /sbin/nologin
옵션으로 ssh shell 로그인을 차단useradd -d /usr/local/tomcat -M -s /sbin/nologin tomcat
pwd
cd ~
yum install -y wget
wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.84/bin/apache-tomcat-8.5.84.tar.gz
/usr/local
로 이동mv apache-tomcat-8.5.84 /usr/local
cd /usr/local
ll
/usr/local/tomcat
심볼릭 링크 생성ln -s apache-tomcat-8.5.84 tomcat
ll
chown -R tomcat:tomcat /usr/local/apache-tomcat-8.5.84
chmod +x /usr/local/apache-tomcat-8.5.84/bin/*.sh
vi /etc/systemd/system/tomcat.service
작성 내용
[Unit]
Description=Apache Tomcat Service
After=syslog.target network.target
[Service]
Type=forking
Environment="JAVA_HOME=/usr/local/java"
Environment="CATALINA_HOME=/usr/local/tomcat"
Environment="CATALINA_BASE=/usr/local/tomcat"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
ExecStart=/usr/local/tomcat/bin/startup.sh
ExecStop=/usr/local/tomcat/bin/shutdown.sh
User=tomcat
Group=tomcat
[Install]
WantedBy=multi-user.target
EOF
systemctl enable tomcat
vi /usr/local/tomcat8/conf/server.xml
// 아래 설정에서 URIEncoding="UTF-8" 추가
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8"
/>
<h1>aaa</h1>
chmod 777 -R /usr/local/tomcat
systemctl start tomcat
systemctl status tomcat
yum install net-tools
netstat -tnlp
firewall-cmd --add-port=8080/tcp
iptables -nL