yum install gcc-c++ 
yum install openssl-devel.x86_64


cd /usr/local/src

wget http://ftp.kaist.ac.kr/Apache/httpd/httpd-2.4.10.tar.gz
wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz
wget http://downloads.sourceforge.net/pcre/pcre-8.35.tar.bz2

tar xvfz apr-1.5.1.tar.gz
tar xvfz apr-util-1.5.3.tar.gz
tar xvfz httpd-2.4.10.tar.gz
tar xvf pcre-8.35.tar.bz2

cd /usr/local/src/apr-1.5.1
./configure --prefix=/usr/local/apr
make
make install


cd /usr/local/src/apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install

cd /usr/local/src/pcre-8.35
./configure --prefix=/usr/local
make
make install


cd /usr/local/src/httpd-2.4.10

./configure  --prefix=/usr/local/apache \
--enable-rule=SHARED_CORE  \
--enable-so  \
--enable-rewrite  \
--enable-vhost-alias  \
--enable-ssl  \
--enable-proxy  \
--enable-shared=max  \
--enable-modules=shared  \
--enable-mods-shared=all  \
--with-apr=/usr/local/apr  \
--with-charset=utf-8  \
--with-mpm=prefork \
--with-apr-util=/usr/local/apr-util
make
make install

wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz -O connector.tar.gz
tar -zxvf connector.tar.gz
cd tomcat-connectors-1.2.40-src/native/
./configure --with-apxs=/usr/local/apache/bin/apxs
make && make install


cd /usr/local/apache/conf/
vi workers.properties



worker.list=pem
worker.pem.port=8009
worker.pem.host=localhost
worker.pem.type=ajp13



vi /usr/local/apache2/conf/httpd.conf\

(변경전) #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
(변경후) LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
 
# 모듈 로드 부분 마지막에 삽입
LoadModule jk_module modules/mod_jk.so
 
# 모듈 설정 부분에 삽입
<IfModule jk_module>
    JkWorkersFile conf/workers.properties
    JkLogFile logs/mod_jk.log
    JkLogLevel error
</IfModule>


(변경전) #Include conf/extra/httpd-vhosts.conf
(변경후) Include conf/extra/httpd-vhosts.conf



#Listen 9090 주석처리


vi /usr/local/apache/conf/extra/httpd-vhosts.conf
Listen 9090 
<VirtualHost *:9090>
    ServerAdmin sun@softmoa.com
    DocumentRoot /data/test/webapp
    ServerName softmoa.com.

    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common

   JkMount  /*.jsp          pem
   JkMount  /*.phyjax      pem
    JkMount  /*.phy        pem
    JkMount  /*.phyin        pem
    JkMount /               pem
    JkMount /j_spring_security_logout pem
    JkMount /j_spring_security_check pem
<Directory "/home/test/webapp">
       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
       Require all granted
 </Directory>

</VirtualHost>


chown apache:apache -R /usr/local/apache
cd /usr/local/apache/bin
chmod +s httpd


vi /usr/lib/systemd/system/apache.service

[Unit]
Description=apache2 Service
After=syslog.target
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecStop=/usr/loacal/apache/bin/apachectl graceful-stop
ExecReload=/usr/local/apache/bin/apachectl graceful
PrivateTmp=true
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target



systemctl enable apache  자동 시작 등록




ps. 톰캣과 연결이 안될경우 8009 (변경했을경우 해당하는 포트) 포트를 tomcat 서버에서 열어줘야하며 아파치에서 사용하는 포트도 아파치 서버에서 열어줘야한다.