- iptables 명령을 통한 port redirection
- 80 → 8080
- sudo iptables -A PREROUTING -t nat -i ens4 -p tcp --dport 80 -j REDIRECT --to-port 8080
- 443 → 8443
- sudo iptables -A PREROUTING -t nat -i ens4 -p tcp --dport 443 -j REDIRECT --to-port 8443
- 80 → 8080
- tomcat server.xml 에 ssl 관련 설정 적용
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" maxThread="150" scheme="https" secure="true" keystoreFile="/home/tomcat/conf/certs/sample.pfx" keystorePass="****" keystoreType="PKCS12" clientAuth="false" sslProtocol="TLS" />
- tomcat web.xml 에 아래 항목 추가
<security-constraint> <web-resource-collection> <web-resource-name>Automatic SSL Forward</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee> CONFIDENTIAL </transport-guarantee> </user-data-constraint> </security-constraint>