Preloader image
DDD

리눅스

Apache 2.4.54 + mode_jk + apr + apr-util + pcre - 소스 컴파일

작성자 관리자 (admin)
조회수 462
입력일 2022-02-19 09:11:42

OS : CentOS

perl 은 필수

*********************************************************
** WEB SERVER
** apr-1.6.5, apr-util-1.6.1, pcre2-10.39 복사

*********************************************************

apr-1.6.1, apr-util-1.6.1, pcre2-10.39 3개의 파일 다운로드
압축해제 후 /httpd-2.4.52/srclib 아래로 버전을 제외한 명칭으로 복사
pcre2-10.39 는 필요한 경우만...

/httpd-2.4.52/srclib# ls -al
total 0
drwxr-xr-x 1  504 staff 4096 Feb 19 00:44 ./
drwxr-xr-x 1  504 staff 4096 Feb 19 08:45 ../
-rw-r--r-- 1 root root     0 Feb 19 08:43 .deps
-rw-r--r-- 1 root root   312 Feb 19 08:43 Makefile
-rw-r--r-- 1  504 staff  121 Feb 11  2005 Makefile.in
drwxr-xr-x 1 1001  1001 4096 Feb 19 08:45 apr/
drwxr-xr-x 1 1001  1001 4096 Feb 19 08:45 apr-util/

drwxr-xr-x 1 1169  1169 4096 Feb 19 00:39 pcre/

*********************************************************
** WEB SERVER - HTTPD Compile
*********************************************************

# ./configure
.
.
configure: summary of build options:

    Server Version: 2.4.52
    Install prefix: /usr/local/apache2 ======> 기본
    C compiler:     gcc
    CFLAGS:          -g -O2 -pthread
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE
    LDFLAGS:
    LIBS:
    C preprocessor: gcc -E

# make
.
.

make[4]: Leaving directory '/root/httpd-2.4.52/modules/mappers'
make[3]: Leaving directory '/root/httpd-2.4.52/modules/mappers'
make[2]: Leaving directory '/root/httpd-2.4.52/modules'
make[2]: Entering directory '/root/httpd-2.4.52/support'
make[2]: Leaving directory '/root/httpd-2.4.52/support'

make[1]: Leaving directory '/root/httpd-2.4.52'

# make install

.
.
Installing configuration files
mkdir /usr/local/apache2/conf
mkdir /usr/local/apache2/conf/extra
mkdir /usr/local/apache2/conf/original
mkdir /usr/local/apache2/conf/original/extra
Installing HTML documents
mkdir /usr/local/apache2/htdocs
Installing error documents
mkdir /usr/local/apache2/error
Installing icons
mkdir /usr/local/apache2/icons
mkdir /usr/local/apache2/logs
Installing CGIs
mkdir /usr/local/apache2/cgi-bin
Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache2/man
mkdir /usr/local/apache2/man/man1
mkdir /usr/local/apache2/man/man8
mkdir /usr/local/apache2/manual
make[1]: Leaving directory '/root/httpd-2.4.52'

# ls -al /usr/local/apache2/
total 0
drwxr-xr-x 1 root root 4096 Feb 19 08:52 ./
drwxr-xr-x 1 root root 4096 Feb 19 00:46 ../
drwxr-xr-x 1 root root 4096 Feb 19 08:51 bin/
drwxr-xr-x 1 root root 4096 Feb 19 08:52 build/
drwxr-xr-x 1 root root 4096 Feb 19 08:51 cgi-bin/
drwxr-xr-x 1 root root 4096 Feb 19 08:51 conf/
drwxr-xr-x 1 root root 4096 Feb 19 08:51 error/
drwxr-xr-x 1 root root 4096 Feb 19 00:27 htdocs/
drwxr-xr-x 1 root root 4096 Feb 19 08:51 icons/
drwxr-xr-x 1 root root 4096 Feb 19 08:52 include/
drwxr-xr-x 1 root root 4096 Feb 19 08:51 lib/
drwxr-xr-x 1 root root 4096 Feb 19 08:51 logs/
drwxr-xr-x 1 root root 4096 Feb 19 08:52 man/
drwxr-xr-x 1 root root 4096 Feb 19 00:27 manual/

drwxr-xr-x 1 root root 4096 Feb 19 08:51 modules/

*********************************************************
** mod_jk Compile
*********************************************************

오류에서 /usr/local/apache2/bin/apxs 를 찾지 못한다는 메세지가 출력된다면
/usr/local/apache2/bin/apxs 를 vi 로 열어 최상단의 #!/bin/perl -w 부분에 whereis perl 로 경로를 찾아 수정 후 다시 컴파일하면 됨.

# cd /root/tomcat-connectors-1.2.48-src/native/
# ./configure -with-apxs=/usr/local/apache2/bin/apxs

# ls -al /root/tomcat-connectors-1.2.48-src/

total 1508
drwxr-xr-x 1 root bin    4096 Feb 19 08:56 ./
drwxr-xr-x 1 root bin    4096 Feb 21  2020 ../
-rw-r--r-- 1 root bin     132 Feb 21  2020 .gitignore
-rw-r--r-- 1 root bin    5031 Feb 21  2020 BUILDING.txt
-rw-r--r-- 1 root root  29486 Feb 19 08:56 Makefile
-rw-r--r-- 1 root bin    1362 Feb 21  2020 Makefile.am
-rw-r--r-- 1 root bin   28899 Feb 21  2020 Makefile.in
-rw-r--r-- 1 root bin    1782 Feb 21  2020 README.txt
-rw-r--r-- 1 root bin   13241 Feb 21  2020 TODO.txt
-rw-r--r-- 1 root bin  372955 Feb 21  2020 aclocal.m4

drwxr-xr-x 1 root bin    4096 Feb 19 09:02 apache-2.0/
-rwxr-xr-x 1 root bin    1277 Feb 21  2020 buildconf.sh*
drwxr-xr-x 1 root bin    4096 Feb 19 08:57 common/
-rw-r--r-- 1 root root  51420 Feb 19 08:56 config.log
-rwxr-xr-x 1 root root    101 Feb 19 08:56 config.nice*
-rwxr-xr-x 1 root root  60193 Feb 19 08:56 config.status*
-rwxr-xr-x 1 root bin  485334 Feb 21  2020 configure*
-rw-r--r-- 1 root bin   21860 Feb 21  2020 configure.ac
drwxr-xr-x 1 root bin    4096 Feb 21  2020 docs/
drwxr-xr-x 1 root bin    4096 Feb 21  2020 iis/
-rwxr-xr-x 1 root root 339432 Feb 19 08:56 libtool*
drwxr-xr-x 1 root bin    4096 Feb 21  2020 netscape/
drwxr-xr-x 1 root bin    4096 Feb 21  2020 scripts
/

# ls -al /root/tomcat-connectors-1.2.48-src/apache-2.0/
total 5752
drwxr-xr-x 1 root bin     4096 Feb 19 09:02 ./
drwxr-xr-x 1 root bin     4096 Feb 19 08:56 ../
-rw-r--r-- 1 root bin       96 Feb 21  2020 .gitignore
drwxr-xr-x 1 root root    4096 Feb 19 08:57 .libs/
-rw-r--r-- 1 root root    3207 Feb 19 08:56 Makefile
-rw-r--r-- 1 root root    1492 Feb 19 08:56 Makefile.apxs
-rw-r--r-- 1 root bin     1434 Feb 21  2020 Makefile.apxs.in
-rw-r--r-- 1 root bin     3068 Feb 21  2020 Makefile.in
-rw-r--r-- 1 root bin     6947 Feb 21  2020 Makefile.vc
-rw-r--r-- 1 root bin     9541 Feb 21  2020 bldjk.qclsrc
-rw-r--r-- 1 root bin    10350 Feb 21  2020 bldjk54.qclsrc
-rw-r--r-- 1 root bin     1335 Feb 21  2020 config.m4
-rw-r--r-- 1 root root 3136314 Feb 19 09:02 mod_jk.a
-rw-r--r-- 1 root bin   146861 Feb 21  2020 mod_jk.c
-rw-r--r-- 1 root root     921 Feb 19 09:02 mod_jk.la
-rw-r--r-- 1 root root     270 Feb 19 08:57 mod_jk.lo
-rw-r--r-- 1 root root  343520 Feb 19 08:57 mod_jk.o

-rwxr-xr-x 1 root root 1829848 Feb 19 09:02 mod_jk.so*

# cp -rfp /root/tomcat-connectors-1.2.48-src/native/apache-2.0/mod_jk.so /usr/local/apache2/modules/

여기까지 모듈 설치는 100% 완료 된 상황.
다음 웹서버를 구동하여 확인

# cd /uar/local/apache2/bin

# ./apachectl start

브라우저에서 http://127.0.0.1 을 띄우면

----------------------------

It works!

WEB SERVER 성공!

----------------------------

tomcat 실행 없이 기동 결과

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

----------------------------

Bad Gateway - AJP 연결이 안된 경우

The proxy server received an invalid response from an upstream server.

----------------------------

404 Error
연동이 되었고 http://127.0.0.1/index.jsp 로 다시 확인 > tomcat 페이지가 출력되면 연동 완료

----------------------------

apache logs : access_log > index.html 실패 , index.jsp 성공
tomcat > webapps > ROOT > index.html 생성하면 해결.

127.0.0.1 - - [19/Feb/2022:10:26:38 +0900] "GET / HTTP/1.1" 404 802
127.0.0.1 - - [19/Feb/2022:10:26:58 +0900] "GET /index.html HTTP/1.1" 404 802
127.0.0.1 - - [19/Feb/2022:10:48:00 +0900] "GET /index.html HTTP/1.1" 404 802
127.0.0.1 - - [19/Feb/2022:10:48:02 +0900] "GET /index.html HTTP/1.1" 404 802
127.0.0.1 - - [19/Feb/2022:10:48:02 +0900] "GET /index.html HTTP/1.1" 404 802
127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /index.jsp HTTP/1.1" 200 11136

127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /tomcat.css HTTP/1.1" 200 5542
127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /tomcat.svg HTTP/1.1" 200 67795
127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /bg-upper.png HTTP/1.1" 200 3103
127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /bg-middle.png HTTP/1.1" 200 1918
127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /bg-nav.png HTTP/1.1" 200 1401
127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /bg-button.png HTTP/1.1" 200 713
127.0.0.1 - - [19/Feb/2022:10:48:13 +0900] "GET /asf-logo-wide.svg HTTP/1.1" 200 27235
127.0.0.1 - - [19/Feb/2022:10:48:17 +0900] "GET /index.jsp HTTP/1.1" 200 11136
127.0.0.1 - - [19/Feb/2022:10:48:17 +0900] "GET /index.jsp HTTP/1.1" 200 11136

^