'Apache'에 해당되는 글 5건

카테고리 없음

apache와 subversion을 연동하여 apache를 실행 시켰을 때 위의 에러가 발생하면 sqlite3이 분명 centos에 버전이 낮아 소스로 설치를 했을 경우일 것이다. 보통 subversion을 컴파일할 때 configure에서 sqlite 경로를 잡아주면 제대로 빌드도 되고 설치도 되지만 apache와 연동할 땐 에러가 난다.

그땐 configure를 실행할 때도 해결방법이 나온다.

sqlite의 소스 디렉토리에 있는 sqlite3.c를 subversion의 소스 디렉토리에 sqlite-amalgamation 디렉토리를 만들어주고 거기에 복사해 넣는다. 그러면 libtool로 sqlite3을 붙여준다.

# mkdir subversion-1.6.6/sqlite-amalgamation
# cp sqlite-3.6.20/sqlite3.c subversion-1.6.6/sqlite-amalgamation/sqlite3.c
# cd subversion-1.6.6
# ./configure –with-apxs=/usr/local/apache/bin/apxs –with-apr=/usr/local/apache/bin/apr-config –with-apr-util=/home/xxx/src/httpd-2.2.9/srclib/apr-util   
# make && make install

그런 뒤에 apache를 실행시켜주면 해결 완료

카테고리 없음

AddDefaultCharset UTF-8 -> AddDefaultCharset off

add
AddCharset us-ascii .ascii .us-ascii
AddCharset ISO-8859-1 .iso8859-1 .latin1
AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3 .iso8859-3 .latin3
AddCharset ISO-8859-4 .iso8859-4 .latin4
AddCharset ISO-8859-5 .iso8859-5 .cyr .iso-ru
AddCharset ISO-8859-6 .iso8859-6 .arb .arabic
AddCharset ISO-8859-7 .iso8859-7 .grk .greek
AddCharset ISO-8859-8 .iso8859-8 .heb .hebrew
AddCharset ISO-8859-9 .iso8859-9 .latin5 .trk
AddCharset ISO-8859-10 .iso8859-10 .latin6
AddCharset ISO-8859-13 .iso8859-13
AddCharset ISO-8859-14 .iso8859-14 .latin8
AddCharset ISO-8859-15 .iso8859-15 .latin9
AddCharset ISO-8859-16 .iso8859-16 .latin10
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5 .Big5 .big5 .b5
AddCharset cn-Big5 .cn-big5
AddCharset WINDOWS-1251 .cp-1251 .win-1251
AddCharset CP866 .cp866
AddCharset KOI8 .koi8
AddCharset KOI8-E .koi8-e
AddCharset KOI8-r .koi8-r .koi8-ru
AddCharset KOI8-U .koi8-u
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-7 .utf7
AddCharset UTF-8 .utf8
AddCharset UTF-16 .utf16
AddCharset UTF-16BE .utf16be
AddCharset UTF-16LE .utf16le
AddCharset UTF-32 .utf32
AddCharset UTF-32BE .utf32be
AddCharset UTF-32LE .utf32le
AddCharset euc-cn .euc-cn
AddCharset euc-gb .euc-gb
AddCharset euc-jp .euc-jp
AddCharset euc-kr .euc-kr
AddCharset EUC-TW .euc-tw
AddCharset gb2312 .gb2312 .gb
AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
AddCharset shift_jis .shift_jis .sjis

Restart Apache2
카테고리 없음

출처 : http://ryudaewan.springnote.com/pages/610881

왜 Apache HTTP Server와 Tomcat을 연동하는가?

Apache Tomcat(이하 Tomcat)은 아마도 가장 널리 알려진 JSP / Servlet Engine일 것입니다. JSP / Servlet 명세에 대한 참조 구현물(Referencial Implementation, 흔히 줄여서 RI라고도 하죠) 역할도 하고 있으며, 실 업무에서도 꽤 씁니다(왕년에 Naver Blog를 쓸 때 한번은 Java Exception Trace log가 Web Browser에 표시된 것을 본 적이 있었습니다. 그 덕에 Naver Blog가 Tomcat을 쓴다는 것을 알았죠).

 

그러나 실전에서는 web server와 tomcat 같은 JSP/Servlet Engine 둘을 연동해서 쓰지, tomcat만 쓰지는 않습니다. 그 이유는 아래와 같습니다.

성능 상의 이유

JSP/Servlet Engine 상에서 동작하는 Servlet이나 JSP라는, (동일한 HTTP Request를 보내도 매 번 그 결과가 다를 수 있는) 동적인 HTTP Response를 생성해 보내는 것들입니다. 그에 비해 단순한 HTML 문서, image, CSS(Cascading Style Sheet), Javascript file은 거의 변할 일는 (동일한 HTTP Request를 보내면 그 결과가 늘 같은) 정적 contents입니다. 이런 정적 contents는 통상적으로 Web Server가 JSP/Servlet Engine보다 더 빠르게 service합니다.

 

감이 오시나요? 결국 정적 content는 정적 contents 처리에 강한 Web Server가 처리하고, 동적 contents는 JSP/Servlet Engine이 맡는 것입니다. 일단 HTTP Request를 Web Server가 먼저 받아보고 정적 contents를 요구하면 자신이 처리하고, 동적 contents request라면 이 request를 JSP/Servlet Engine에게 넘기죠. 아니면 특정 URL pattern이 들어오면 JSP/Servlet Engine으로 넘기는 방법도 있습니다. 결국 이렇게 하면 부수적으로 동적 contents 생성하느라 바쁜 JSP/Servlet Engine에 부하를 덜 줄 수 있고 정적 contents service하느라 귀중한 JVM Heap을 아낄 수 있는 이점도 누릴 수 있습니다.

보안 상의 이유

보통 JSP/Servlet Engine은 중요한 업무 절차에 대한 구현을 가지고 있게 마련입니다. 단순한 image, CSS 같은 정적 contents를 담은 Web Server보다 더 안전해야 보호해야 한다는 뜻이 됩니다. 보통 어떤 기업 같은 조직의 network를 구성할 경우 외부 network와 조직의 network를 방화벽(firewall)으로 단절시키고 방화벽에 규칙(rule)을 등록, IP packet이 제한적으로만 그 방화벽을 넘다들 수 있도록 합니다. 안전성이 더 높아야 하는 server들이 있는 network zone는 여기에 한 번 더 방화벽을 칩니다. 그리고 이 두 방화벽 사이의 network zone을 DMZ라고 합니다.

 

이렇게 Web Server와 JSP/Servlet Engine을 따로따로 쓰면 DMZ에 덜 중요한 data를 가진 web server를 놓고 이중 방화벽 뒤에 있는 network zone에 JSP/Servlet Engine을 놓음으로써 높은 보안성을 획득하면서도 외부에 동적 contents를 제공할 수 있게 됩니다.

가용성 상의 이유

web server도 하나, JSP/Servlet Engine도 하나라면 둘 중 하나만 죽으면 정상적인 service가 불가능합니다. 따라서 절대 멈추면 안되는 service(세계화가 되면서 이런 요구 사항은 더 늘었습니다. 지구 상 어딘가는 늘 업무 시간이니까요)를 담당하는 web server, JSP/Servlet Engine은 두 개 이상을 가동하는 이중화를 적용합니다.

 

web server가 어떤 HTTP Request를 받아 이를 JSP/Servlet Engine으로 넘기려 할 때 그 JSP/Servlet Engine이 이중화가 되어 있다면 web server는 이 request를 좀 한가한 JSP/Servlet Engine에 넘긴다던지 할 수 있습니다(물론 실제로는 간단하게는 round robin부터 시작해서 이에 대한 여러가지 방법이 있습니다). 내지는 JSP/Servlet Engine 중 하나가 비정상적으로 종료한 상태이면 현재 살아 있는 JSP/Servlet Engine에게 이 request 처리를 위임, 전반적인 service 중단을 막을 수 있습니다.

 

준비물

  • Apache Tomcat

    • Apache Tomcat : Apache Tomcat 대표 site. Tomcat을 내려받으려면 가야 하는 곳.
  • Apache HTTP Server

    • Apache HTTP Server : Apache HTTP Server 대표 site.
    • Apache Lounge : Windows용 Apache HTTP Server 정보가 풍부함. Windows용 Apache HTTP Server는 여기에서 받을 것을 추천!
  • mod_jk

    • Apache Tomcat : Apache Tomcat 대표 site. mod_jk도 여기서 받을 수 있습니다(이 site에서는 mod_jk를 'Apache Connector'라고 부릅니다).

 

작업 절차

 

간단한 구성

간단한 구성이란, 개발이나 가벼운 Web Service 운영을 목적으로 하나의 Apache HTTP Server + 하나의 Tomcat 연동 구성을 하는 것입니다. 이 작업에 대한 구체적 작업 절차는 [tomcat]apache, tomcat 연동하기 글에서 잘 설명하고 있습니다(Windows / Linux에서 mod_jk로 Apache와 Tomcat 연동하는 것을 proxy_module과 같이 설치할 경우와 아닌 경우 모두 설명하고 있습니다).

 

고가용성을 위한 구성

Naver Blog와 같이 사용자가 많다거나 장애 등을 감내할 수 있는(Fault Tolerant) Web Service를 구성하려면 위 간단한 구성으로는 어렵고 여러 개의 Apache HTTP Server + 여러 개의 Tomcat 연동 구성을 해야 합니다. 이렇게 해야 일부 Apache HTTP Server나 Tomcat이 죽어도 나머지들이 request를 처리할 수 있지요. 이러한 특성을 고가용성(High Availability)이라 하는데 이 고가용성은 위와 같은 단순한 설정만으로는 얻기 어렵습니다. 이런 고가용성 설정은 '아파치와 톰캣을 활용한 대용량 웹서비스 운영'이란 글에서 잘 설명하고 있습니다.

 

참고 문헌

 

예시

  • Apache HTTPD 2.2 설정 file : mod_jk로 Apache HTTP Server 2.2와 Tomcat 6을 연동시킨 결과로 나온 Apache Web Server 2.2 설정 file.
  • Apache Tomcat 6 설정 file : mod_jk로 Apache HTTP Server 2.2와 Tomcat 6을 연동시킨 결과로 나온 Apache Tomcat 6 설정 file.
  • mod_jk.conf : 실제 mod_jk 설정 정보를 담은 mod_jk 설정 file.
카테고리 없음

퍼옴

// --------------------------------------------------------------------------- 
OS : CentOS release 5.2 

* OS 설치시 package Group 내가 선택한 것.. 
- Editors 
- Engineering and Scientific 
- Development Tools 
- Administration Tools 
- System Tools 


mysql 설치 
mysql-5.0.24 

configure 시 오류 메세지 
오류 메세지 : checking for termcap functions library... configure: error: No curses/termcap library found 
해결 방법 : yum -y install ncurses-devel 

./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-charset=euckr --enable-thread-safe-client 
make && make install 

# cd /usr/local/mysql/bin 
# ./mysql_install_db 
# useradd -M mysql 
# chown -R mysql:mysql /usr/local/mysql/data 
# /usr/local/mysql/bin/mysqld_safe & 
# cd /usr/local/mysql/bin 
# ./mysqladmin -u root password 암호 
# ./mysql -u root -p mysql 

apache 설치 
httpd-2.0.63 
접속자 수 최대로 올리기 
# vi server/mpm/prefork/prefork.c 
[EDITOR]#define DEFAULT_SERVER_LIMIT 256 을 
[EDITOR]#define DEFAULT_SERVER_LIMIT 1280 으로 수정 
저장하고 아웃 
# vi server/mpm/worker/worker.c 
[EDITOR]#define DEFAULT_SERVER_LIMIT 16 을 
[EDITOR]#define DEFAULT_SERVER_LIMIT 20 으로 수정 
저장하고 아웃 
./configure --prefix=/usr/local/apache2 --enable-so --enable-modules=so --with-mpm=worker --enable-rewrite 
make && make install 


php 설치 
php-5.2.6 
configure 시 오류 
오류 메세지 : configure: error: xml2-config not found. Please check your libxml2 installation 
해결 방법 : yum install libxml2 libxml2-devel -y 

오류 메세지 : configure: error: Please reinstall the BZip2 distribution 
해결 방법 : yum -y install bzip2-devel 

오류 메세지 : configure: error: libjpeg.(a|so) not found. 
해결 방법 : yum -y install libjpeg-devel 

오류 메세지 : configure: error: libpng.(a|so) not found. 
해결 방법 : yum -y install libpng-devel 

오류 메세지 : configure: error: freetype.h not found. 
해결 방법 : yum -y install freetype-devel 

오류 메세지 : configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information. 
해결 방법 : yum -y install libc-client-devel 

오류 메세지 : configure: error: Kerberos libraries not found. 
해결 방법 : yum -y install krb5-devel 

오류 메세지 : configure: error: Cannot find OpenSSL's <evp.h> 
해결 방법 : yum -y install openssl-devel 

./configure --enable-bcmath --enable-ftp --enable-filepro --enable-libxml2 --enable-memory-limit --enable-sockets --enable-spl --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-versioning --enable-wddx --disable-cli --disable-debug --disable-dmalloc --disable-posix --disable-rpath --with-apxs2=/usr/local/apache2/bin/apxs --with-bz2 --with-freetype-dir --with-gd --with-gettext --with-imap=shared --with-jpeg-dir --with-kerberos --with-libxml-dir --with-mod-charset --with-mysql=/usr/local/mysql --with-png-dir --with-ttf --with-zlib --with-mysqli=/usr/local/mysql/bin/mysql_config --with-imap-ssl=/usr/lib --with-openssl 
ssl 추가시  


apache httpd.conf 설정 

NameVirtualHost *:80 
ServerName *:80 

KeepAlive On 
KeepAliveTimeout 2 
(2초간 접속을 끊지 않고 기다린다..) 

Timeout 30 
(dos 공격 방지) 

ServerLimit 20 --> 서버 갯수를 설정 
StartServers 20 --> 아파치를 처음 시작할때 생성하는 서버 갯수 
MaxClients 500 --> ThreadsPerChild * StartServers 값 
ThreadsPerChild 25 --> 서버 하나가 만들어 낼수 있는 쓰레드 갯수입니다. 최대 64개 
MinSpareThreads 25 --> 서버 하나가 만들어 낼수 있는 쓰레드의 최소 갯수입니다. 보통은 ThreadsPerChild 와 맞추어 줌 
MaxSpareThreads 500 --> 시스템 전체에서 만들어 낼수 있는 쓰레드 갯수의 최대치 


<VirtualHost *:80> 
    AddType application/x-httpd-php .php .html .inc .htm 
    #php 를 인식 시킬 확장자 명 
    ServerAdmin 이메일 
    #서버 관리자 이메일 
    DocumentRoot /home/test 
    #html 을 읽을 위치 
    ServerName 도메인 
    #도메인 주소 
#  php_admin_value auto_prepend_file /home/test/move_url/move_page.html 
    #도메인 접근시 최초 열어볼 페이지 주소 
#  RewriteEngine on 
    #Rewrite Engine 사용 여부 
#  RewriteRule ^/([a-zA-Z0-9]+)$ /home/test/rewrite.html?rewrite=$i 
    #Rewrite 사용시 load 할 페이지 주소 
    php_admin_flag register_globals On 
    #register_global 설정 
</VirtualHost> 

apache modules directory에서
#> chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t libphp5.so

카테고리 없음
First
Download httpd source.
http://apache.tt.co.kr/httpd/httpd-2.2.11.tar.gz 

Second
Move and Uncompress.
- mv httpd-2.2.11.tar.gz /usr/local/
- tar xvfz httpd-2.2.11.tar.gz
- cd httpd-2.2.11

Third
Source tree setting. use to "./configure". and make & make install.
- ./configure --prefix=/usr/local/apache2 --enable-rewrite=shared --enable-speling=shared
- make & make install

Fourth
Environmental set. and Start.
- vim /usr/local/apache2/conf/httpd.conf
Edit ServerName,
- /usr/local/apache2/bin/apachectl -f /usr/local/apache2/conf/httpd.conf
1
블로그 이미지

개발자

우와신난다