본문 바로가기

Linux Server 구축/1-2. Web Server

APM - Apache 소스설치


5. Apache 소스 설치

[root@localhost httpd-2.2.10]# pwd
/usr/local/src/httpd-2.2.10
[root@localhost httpd-2.2.10]# ./configure --help
[root@localhost httpd-2.2.10]# ./configure --prefix=/usr/local/apache --enable-mods-shared=most --enable-module=so
--prefix=/usr/local/apache     - apache가 설치될 디렉토리를 지정하는 것
--enable-mods-shared=most --enable-module=so   - DSO방식으로 PHP모듈이 사용될 수 있도록 지정하는 옵션

- 중략

config.status: creating include/ap_config_auto.h
config.status: executing default commands

[root@localhost httpd-2.2.10]#

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

[root@localhost httpd-2.2.10]# make

- 중략

make[4]: Leaving directory `/usr/local/src/httpd-2.2.10/modules/mappers'
make[3]: Leaving directory `/usr/local/src/httpd-2.2.10/modules/mappers'
make[2]: Leaving directory `/usr/local/src/httpd-2.2.10/modules'
make[2]: Entering directory `/usr/local/src/httpd-2.2.10/support'
make[2]: Leaving directory `/usr/local/src/httpd-2.2.10/support'

make[1]: Leaving directory `/usr/local/src/httpd-2.2.10'
[root@localhost httpd-2.2.10]#

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

[root@localhost httpd-2.2.10]# make install

- 중략

mkdir /usr/local/apache/man
mkdir /usr/local/apache/man/man1
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
make[1]: Leaving directory `/usr/local/src/httpd-2.2.10'

[root@localhost httpd-2.2.10]#

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

httpd.conf 파일 확인

[root@localhost apache]# pwd
/usr/local/apache
[root@localhost apache]# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules
[root@localhost apache]# cd conf
[root@localhost conf]# ls
extra  httpd.conf  magic  mime.types  original

[root@localhost conf]# pwd
/usr/local/apache/conf
[root@localhost conf]# vi httpd.conf
 
29 ServerRoot "/usr/local/apache"  - 설치되어 있는 경로

- 이전에 설치했던 httpd.conf 파일
[root@server3 conf]# vi /etc/httpd/conf/httpd.conf.rpmsave

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

DocumentRoot = /usr/local/apache/htdocs 경로 확인

[root@localhost htdocs]# pwd
/usr/local/apache/htdocs
[root@localhost htdocs]# ls
apache_pb.gif  apache_pb22.gif  apache_pb22_ani.gif
apache_pb.png  apache_pb22.png  index.html
[root@localhost htdocs]# vi index.html
[root@localhost htdocs]# cat index.html
<html><body><h1>It works!</h1>
Hello!! <br>
bban2.co.kr<br>
</body></html>
[root@localhost htdocs]#

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

MPM 확인

[root@localhost conf]# pwd
/usr/local/apache/conf
[root@localhost conf]# ls
extra  httpd.conf  magic  mime.types  original
[root@localhost conf]# cd extra
[root@localhost extra]# ls
httpd-autoindex.conf  httpd-languages.conf           httpd-ssl.conf
httpd-dav.conf        httpd-manual.conf              httpd-userdir.conf
httpd-default.conf    httpd-mpm.conf                 httpd-vhosts.conf
httpd-info.conf       httpd-multilang-errordoc.conf
[root@localhost extra]# vi httpd-mpm.conf
[root@localhost extra]# /usr/local/apache/bin/httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
[root@localhost extra]#

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

Apache 구동 확인
 
[root@localhost extra]# ps aux | grep httpd
root      5639  0.0  0.0   5188   732 pts/1    R+   13:53   0:00 grep httpd
[root@localhost extra]# ps aux | grep apache
root      5641  0.0  0.0   5188   740 pts/1    S+   13:53   0:00 grep apache
[root@localhost extra]# /usr/local/apache/bin/apachectl start
[root@localhost extra]# ps aux | grep apache
root      5646  0.0  0.1   4552  2024 ?        Ss   13:53   0:00 /usr/local/apache/bin/httpd -k start
daemon    5647  0.0  0.1   4684  1516 ?        S    13:53   0:00 /usr/local/apache/bin/httpd -k start
daemon    5648  0.0  0.1   4684  1516 ?        S    13:53   0:00 /usr/local/apache/bin/httpd -k start
daemon    5649  0.0  0.1   4684  1516 ?        S    13:53   0:00 /usr/local/apache/bin/httpd -k start
daemon    5650  0.0  0.1   4684  1516 ?        S    13:53   0:00 /usr/local/apache/bin/httpd -k start
daemon    5651  0.0  0.1   4684  1516 ?        S    13:53   0:00 /usr/local/apache/bin/httpd -k start
root      5654  0.0  0.0   5188   756 pts/1    S+   13:53   0:00 grep apache
[root@localhost extra]#

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

예) Apache 테스트
rpm으로 설치, 설정했던 www1.server3.co.kr을 소스설치한 apache로 구현해보시오.


1. httpd.conf 환경 파일 설정

[root@localhost conf]# pwd
/usr/local/apache/conf
[root@localhost conf]# vi httpd.conf

29 ServerRoot "/usr/local/apache" - 아파치가 설치된 경로

160 <Directory />                 - 디렉토리 퍼미션 설정
161     Options FollowSymLinks
162     AllowOverride None
163     Order deny,allow
164 #   Deny from all - 기본 설정은 거부이므로 허용으로 설정해준다.
165     Allow from all   - deny from all 으로 설정해 두면 웹사이트 접속시 퍼미션과 관련된 에러가 뜬다.
166 </Directory>

434 # Virtual hosts
435 Include conf/extra/httpd-vhosts.conf - 가상호스트 모듈을 추가한다.

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

2. Virtual Host 환경 파일 설정

[root@localhost3 extra]# pwd
/usr/local/apache/conf/extra
[root@localhost extra]# vi httpd-vhosts.conf

19 #NameVirtualHost *:80
20 NameVirtualHost 10.10.33.3:80

28 #<VirtualHost *:80>
29 #    ServerAdmin webmaster@dummy-host.example.com
30 #    DocumentRoot "/usr/local/apache/docs/dummy-host.example.com"
31 #    ServerName dummy-host.example.com
32 #    ServerAlias www.dummy-host.example.com
33 #    ErrorLog "logs/dummy-host.example.com-error_log"
34 #    CustomLog "logs/dummy-host.example.com-access_log" common
35 #</VirtualHost>

37 <VirtualHost 10.10.33.3:80>
38     ServerAdmin root@server3.co.kr
39     DocumentRoot "/www1"
40     ServerName www1.server3.co.kr
41 </VirtualHost>
 
43 <VirtualHost 10.10.33.3:80>
44     ServerAdmin root@server3.co.kr
45     DocumentRoot "/usr/local/apache/htdocs"
46     ServerName www.server3.co.kr
47 </VirtualHost>

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

[root@localhost conf]# /usr/local/apache/bin/apachectl restart - Apache 서비스 재시작

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

3. 웹브라우저에서 확인

[root@localhost extra]# host www1.server3.co.kr
www1.server3.co.kr has address 10.10.33.3



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

[root@localhost apache]# tail -f  /usr/local/apache/logs/error_log  - 에러 로그 확인

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

6.  PHP 소스설치 (http://bban2.tistory.com/149)

'Linux Server 구축 > 1-2. Web Server' 카테고리의 다른 글

PHPMyAdmin  (0) 2008.12.17
Tomcat JSP Server 소스설치  (0) 2008.12.17
APM - PHP 소스설치  (0) 2008.12.16
APM - MySQL 소스설치  (0) 2008.12.16
APM - 소스 설치  (0) 2008.12.16
Tomcat JSP 서버 - RPM 설치  (0) 2008.12.16