conf: 톰켓 AJP 모듈 활성화 - local-can, prod-can(천안) 인 경우만 port 18009
parent
6ab0af4ea4
commit
e0c7aa5ecc
@ -0,0 +1,37 @@
|
|||||||
|
package kr.xit.core.spring.config.support;
|
||||||
|
|
||||||
|
import java.net.*;
|
||||||
|
|
||||||
|
import org.apache.catalina.connector.*;
|
||||||
|
import org.apache.coyote.ajp.*;
|
||||||
|
import org.springframework.boot.web.embedded.tomcat.*;
|
||||||
|
import org.springframework.boot.web.servlet.server.*;
|
||||||
|
import org.springframework.context.annotation.*;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Profile({"local-can", "prod-can"})
|
||||||
|
public class TomcatConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ServletWebServerFactory servletContainer() {
|
||||||
|
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
|
||||||
|
tomcat.addAdditionalTomcatConnectors(createAjpConnector());
|
||||||
|
return tomcat;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Connector createAjpConnector() {
|
||||||
|
Connector ajpConnector = new Connector("AJP/1.3");
|
||||||
|
ajpConnector.setPort(18009);
|
||||||
|
ajpConnector.setSecure(false);
|
||||||
|
ajpConnector.setAllowTrace(false);
|
||||||
|
ajpConnector.setScheme("http");
|
||||||
|
((AbstractAjpProtocol) ajpConnector.getProtocolHandler()).setSecretRequired(false);
|
||||||
|
try {
|
||||||
|
AjpNioProtocol protocol = (AjpNioProtocol) ajpConnector.getProtocolHandler();
|
||||||
|
protocol.setAddress(InetAddress.getByName("0.0.0.0"));
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return ajpConnector;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue