tomcat 80 port

Server/CentOS 2016. 6. 9. 00:49

톰캣의 8080 포트를 80 포트로 변경하는 방법들은 운영체제별로, 배포판 별로 조금씩 다르다.

레드햇 계열에서는 다음의 방법들이 있다.

  1. apache 연동
  2. authbind
  3. iptables


이 중에서 아무 설치없이 바로 사용할 수 있는 iptables 를 사용해 봤다.


# vi /etc/init.d/iptables
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
 
# /etc/init.d/iptables save
# /etc/init.d/iptables restart
# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:http redir ports 8080
cs


엄밀히 말하자면 tomcat 의 기본 포트를 변경한 것이 아니라,

서버로 들어오는 80 포트를 8080 포트로 리다이렉트 시킨 것이다. ^^




WRITTEN BY
손가락귀신
정신 못차리면, 벌 받는다.

,