[Apache + Tomcat] Proxy 모듈 통한 WEB/WAS 연동
오픈소스/Apache + Tomcat

[Apache + Tomcat] Proxy 모듈 통한 WEB/WAS 연동

728x90
반응형

Apache 작업

1) httpd.conf 수정

a. mod_proxy.so, mod_proxy_http.so, mod_rewrite.so 주석제거


b. Include conf/extra/httpd-vhosts.conf  주석제거

2) httpd-vhost.conf 수정

<VirtualHost *:80>
    ServerAdmin root@localhost
    ServerName test.com
    DefaultType text/html

    CustomLog "|/data/apache2.4/bin/rotatelogs /data/apache2.4/logs/access_%Y_%m_%d.log 86400 +540" common env=!exceptlist

    <LocationMatch "\.(php|sql|inc|env|sh)$">
        Require all denied
    </LocationMatch>

    # 서비스에 필요시 주석제거
    #Header set X-Frame-Options "allow-from *"
    #Header set Access-Control-Allow-Origin "*"

    ProxyRequests off
    ProxyPreserveHost On
    ProxyPass / http://WASIP:8080/
    ProxyPassReverse / http:/WASIP:8080/

</VirtualHost>



*Apache, Tomcat 서비스 등록
1) Apache 서비스 등록

sudo cp /data/apache2.4/bin/apachectl /etc/init.d/httpd

sudo update-rc.d httpd defaults

systemctl start httpd

systemctl enable httpd

 

2) Tomcat 서비스 등록

cd /etc/systemd/system
sudo vi ./tomcat.service
sudo chmod 755 ./tomcat.service
sudo systemctl enable tomcat.service
sudo systemctl start tomcat.service
[Unit]
Description=tomcat 9
After=network.target syslog.target

[Service]
Type=forking
Environment="JAVA_HOME=/data/jdk8"
Environment="CATALINA_HOME=/data/tomcat9"
User=ubuntu
Group=ubuntu
ExecStart=/data/tomcat9/bin/startup.sh
ExecStop=/data/tomcat9/bin/shutdown.sh

[Install]
WantedBy=multi-user.target
728x90
728x90