강좌
클라우드/리눅스에 관한 강좌입니다.
자격증 분류

리눅스마스터1급 : 웹 서버 설정하기

작성자 정보

  • 관리자 작성
  • 작성일

컨텐츠 정보

본문

리눅스마스터1: 웹 서버 설정하기

 

 

1) 아파치 환경 설정

 

 

그럼 APACHE를 구성하고 있는 디렉토리들과 관련 파일들에 대해서 알아보도록하겠다.

 

 

 

여기서 설명하는 디렉토리의 구성은 아파치를 직접 컴파일하여 설치하였을 경우의 예로서 아파치를 rpm으로 설치하였을 경우에는 “rpm -ql 패키지명과 같은 방법으로 확인해 볼 수 있다.

 

 

 

다음은 아파치의 홈디렉토리이다.

 

 

 

 

 

아파치 웹서버가 설치된 경로를 확인하면 다음과 같다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# tree -d -L 1 /usr/local/apache/

/usr/local/apache/

|-- bin

|-- build

|-- cgi-bin

|-- conf

|-- error

|-- htdocs

|-- icons

|-- include

|-- lib

|-- logs

|-- man

|-- manual

`-- modules

 

 

 

 

 

 

 

위 디렉토리들의 역할은 다음과 같다.

 

 

 

 

 

디렉토리

용도 및 내용

bin/

아파치 실행파일들이 들어있음.

build/

아파치 개발에 관련된 라이브러리 및 도구들.

cgi-bin/

아파치에서 사용하는 CGI파일들이 들어가는 위치

conf/

아파치 설정파일들(: httpd.conf)이 들어있는 위치

error/

아파치 에러코드에 따른 에러문서들이 들어있음.

htdocs/

아파치 웹문서들이 들어가는 위치

icons/

아파치웹서버에 필요한 기본 아이콘 이미지파일들이 존재함.

include/

아파치웹서버에 필요한 C 헤드파일들이 존재하는 위치.

lib/

아파치에 필요한 여러가지 라이브러리들이 있음.

logs/

아파치 웹로그(access_log, error_log)들이 존재하는 위치

man/

아파치 도움말파일(man페이지 파일)들이 들어있는 위치

manual/

아파치 매뉴얼파일들이 들어있는 위치

modules/

DSO방식의 아파치에서 로드할 모듈파일이 들어가는 위치

 

이 디렉토리들 가운데 꼭 알아야하는 디렉토리들에 대하여 하나씩 살펴보도록하겠다.

 

 

 

 

아파치 실행파일 디렉토리(/usr/local/apache/bin)

 

 

이 디렉토리내에는 아파치웹서버운용에 필요한 여러가지 실행파일들이 들어있다.

 

 

 

이들 파일들에 대한 간단히 설명하자면 다음과 같다.

 

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/bin/

합계 3316

-rwxr-xr-x 1 root root 118788 54 06:38 ab

-rwxr-xr-x 1 root root 3425 54 06:27 apachectl

-rwxr-xr-x 1 root root 6986 54 06:38 apr-1-config

-rwxr-xr-x 1 root root 6456 54 06:38 apu-1-config

-rwxr-xr-x 1 root root 22652 54 06:27 apxs

-rwxr-xr-x 1 root root 12694 54 06:38 checkgid

-rwxr-xr-x 1 root root 8925 54 06:27 dbmmanage

-rw-r--r-- 1 root root 1071 54 06:27 envvars

-rw-r--r-- 1 root root 1071 54 06:27 envvars-std

-rwxr-xr-x 1 root root 44226 54 06:38 htcacheclean

-rwxr-xr-x 1 root root 30962 54 06:38 htdbm

-rwxr-xr-x 1 root root 22010 54 06:38 htdigest

-rwxr-xr-x 1 root root 30847 54 06:38 htpasswd

-rwxr-xr-x 1 root root 2969595 54 06:38 httpd

-rwxr-xr-x 1 root root 20723 54 06:38 httxt2dbm

-rwxr-xr-x 1 root root 22111 54 06:38 logresolve

-rwxr-xr-x 1 root root 25037 54 06:38 rotatelogs

 

 

 

 

 

 

 

ab : 아파치 밴치마킹툴(사용법 뒤에서 자세히 설명함.)

 

 

apachectl : 아파치 시작/종료/재시작과 설정파일(httpd.conf)검사등을 하는 툴.

 

 

htpasswd : 특정페이지 암호인증에서 ID와 암호를 생성하는 툴.

 

 

htdigest : 사용자 인증파일을 생성하고 업데이트하기 위한 툴.

 

 

httpd : 아파치 웹데몬 파일

 

 

logresolve : 아파치 로그파일에서 IP주소에 대한 호스트네임을 리졸빙하는 툴

 

 

rotatelogs : 아파치 웹로그파일을 로테이트하기 위한 툴.

 

 

 

 

 

 

아파치 로그디렉토리(/usr/local/apache/logs)

 

 

이 디렉토리는 아파치 웹로그파일들을 저장하고있는 디렉토리이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/logs/

합계 8

-rw-r--r-- 1 root root 0 54 06:49 access_log

-rw-r--r-- 1 root root 547 56 11:31 error_log

-rw-r--r-- 1 root root 5 56 11:31 httpd.pid

 

 

 

 

 

 

 

access_log : 홈페이지 방문자들의 방문기록을 하는 웹로그 파일

 

 

error_log : 홈페이지 에러발생시에 기록하는 에러로그 파일

 

 

httpd.pid : 아파치 프로세스의 PID를 저장하고있는 파일

 

 

 

 

아파치 웹문서 디렉토리(/usr/local/apache/htdocs)

 

 

 

아파치웹서버의 기본홈페이지 문서인 index.html파일이 저장되어있는 디렉토리이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/htdocs/

합계 4

-rw-r--r-- 1 root root 44 1121 2004 index.html

 

 

 

 

 

 

 

 

아파치 주설정파일 디렉토리(/usr/local/apache/conf)

 

 

 

아파치웹서버의 메인 설정파일(httpd.conf)mime.types파일이 존재하는 디렉토리이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/conf/

합계 112

drwxr-xr-x 2 root root 4096 54 06:38 extra

-rw-r--r-- 1 root root 13659 56 11:16 httpd.conf

-rw-r--r-- 1 root root 13659 56 11:16 httpd.conf.bak

-rw-r--r-- 1 root root 12958 54 06:38 magic

-rw-r--r-- 1 root root 53011 54 06:38 mime.types

drwxr-xr-x 3 root root 4096 54 06:38 original

 

 

 

 

 

 

 

 

httpd.conf : 아파치웹서버의 주설정파일

 

 

mime.types : 아파치웹서버의 MIME타입설정파일

 

 

 

 

 

 

아파치 부가설정파일 디렉토리(/usr/local/apache/conf/extra)

 

 

 

이 디렉토리에는 각 용도별 아파치웹서버의 설정파일들이 별도로 존재하는 위치이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/conf/extra/

합계 56

-rw-r--r-- 1 root root 2843 54 06:38 httpd-autoindex.conf

-rw-r--r-- 1 root root 1713 54 06:38 httpd-dav.conf

-rw-r--r-- 1 root root 2344 54 06:38 httpd-default.conf

-rw-r--r-- 1 root root 1103 54 06:38 httpd-info.conf

-rw-r--r-- 1 root root 5078 54 06:38 httpd-languages.conf

-rw-r--r-- 1 root root 916 54 06:38 httpd-manual.conf

-rw-r--r-- 1 root root 3789 54 06:38 httpd-mpm.conf

-rw-r--r-- 1 root root 2183 54 06:38 httpd-multilang-errordoc.conf

-rw-r--r-- 1 root root 11049 54 06:38 httpd-ssl.conf

-rw-r--r-- 1 root root 817 54 06:38 httpd-userdir.conf

-rw-r--r-- 1 root root 1491 54 06:38 httpd-vhosts.conf

 

 

 

 

 

 

 

httpd-autoindex.conf : 디렉토리의 내용을 어떻게 로딩할 것인가에 관한 아파치설정파일

 

 

httpd-dav.conf : WebDAV에 관한 아파치 설정파일

 

 

httpd-default.conf : 아파치웹서버의 기본설정사항들이 설정되어있는 설정파일

 

 

httpd-info.conf : 아파치실행모니터링과 실행상태정보를 설정하는 아파치설정파일

 

 

httpd-languages.conf : 다른 언어들을 어떻게 표현할 것인가에 대한 아파치 설정파일

 

 

httpd-manual.conf : 아파치웹서버의 매뉴얼제공에 대한 설정파일

 

 

httpd-mpm.conf : 아파치웹서버의 MPM specific에 대한 설정파일

 

 

httpd-multilang-errordoc.conf : 콘텐츠협상을 통한 에러문서(Error Document) 설정파일

 

 

httpd-ssl.conf : SSL지원을 위한 아파치 설정파일

 

 

httpd-userdir.conf : 사용자 홈디렉토리에 관한 설정파일

 

 

httpd-vhosts.conf : 아파치 가상호스트에 대한 설정파일

 

 

 

 

 

 

 

 

CGI 파일 디렉토리(/usr/local/apache/cgi-bin)

 

 

아파치웹서버에서 CGI파일들이 존재하는 디렉토리이다.

 

 

 

모든 사용자들이 공통적으로 사용할 CGI파일들을 보관하고 있다.

 

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/cgi-bin/

합계 8

-rw-r--r-- 1 mysql mysql 294 1211 2004 printenv

-rw-r--r-- 1 mysql mysql 779 1211 2004 test-cgi

 

 

 

 

 

 

 

오류 페이지가 저장된 디렉토리(/usr/local/apache/error)

 

 

 

아파치웹서버의 에러문서를 저장하고있는 디렉토리로서 에러코드별로 별도의 파일들이 지정되어있다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/error/

합계 196

-rw-r--r-- 1 mysql mysql 9544 129 2010 HTTP_BAD_GATEWAY.html.var

-rw-r--r-- 1 mysql mysql 6902 129 2010 HTTP_BAD_REQUEST.html.var

-rw-r--r-- 1 mysql mysql 11736 129 2010 HTTP_FORBIDDEN.html.var

-rw-r--r-- 1 mysql mysql 13420 1228 2010 HTTP_GONE.html.var

-rw-r--r-- 1 mysql mysql 13403 1228 2010 HTTP_INTERNAL_SERVER_ERROR.html.var

-rw-r--r-- 1 mysql mysql 7944 1228 2010 HTTP_LENGTH_REQUIRED.html.var

-rw-r--r-- 1 mysql mysql 7080 1228 2010 HTTP_METHOD_NOT_ALLOWED.html.var

-rw-r--r-- 1 mysql mysql 13566 1228 2010 HTTP_NOT_FOUND.html.var

-rw-r--r-- 1 mysql mysql 6627 1228 2010 HTTP_NOT_IMPLEMENTED.html.var

-rw-r--r-- 1 mysql mysql 6861 1228 2010 HTTP_PRECONDITION_FAILED.html.var

-rw-r--r-- 1 mysql mysql 8165 129 2010 HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

-rw-r--r-- 1 mysql mysql 7371 129 2010 HTTP_REQUEST_TIME_OUT.html.var

-rw-r--r-- 1 mysql mysql 7385 129 2010 HTTP_REQUEST_URI_TOO_LARGE.html.var

-rw-r--r-- 1 mysql mysql 8233 129 2010 HTTP_SERVICE_UNAVAILABLE.html.var

-rw-r--r-- 1 mysql mysql 13557 1228 2010 HTTP_UNAUTHORIZED.html.var

-rw-r--r-- 1 mysql mysql 6626 129 2010 HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

-rw-r--r-- 1 mysql mysql 7374 1228 2010 HTTP_VARIANT_ALSO_VARIES.html.var

-rw-r--r-- 1 mysql mysql 1979 712 2006 README

-rw-r--r-- 1 mysql mysql 4245 1228 2010 contact.html.var

drwxr-xr-x 2 mysql mysql 4096 221 06:13 include

 

 

 

 

 

 

 

아이콘 파일이 저장된 디렉토리(/usr/local/apache/icons)

 

 

아파치웹서버에서 기본적으로 사용하고있는 이미지아이콘파일들을 저장하고있는 디렉토리이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/icons/

합계 684

-rw-r--r-- 1 mysql mysql 5108 828 2007 README

-rw-r--r-- 1 mysql mysql 36057 828 2007 README.html

-rw-r--r-- 1 mysql mysql 246 1121 2004 a.gif

-rw-r--r-- 1 mysql mysql 306 1126 2008 a.png

-rw-r--r-- 1 mysql mysql 242 1121 2004 alert.black.gif

-rw-r--r-- 1 mysql mysql 293 1126 2008 alert.black.png

-rw-r--r-- 1 mysql mysql 247 1121 2004 alert.red.gif

-rw-r--r-- 1 mysql mysql 314 1126 2008 alert.red.png

-rw-r--r-- 1 mysql mysql 2326 1121 2004 apache_pb.gif

-rw-r--r-- 1 mysql mysql 2088 1126 2008 apache_pb.png

-rw-r--r-- 1 mysql mysql 1797 1126 2008 apache_pb2.gif

-rw-r--r-- 1 mysql mysql 1505 1126 2008 apache_pb2.png

-rw-r--r-- 1 mysql mysql 2434 1126 2008 apache_pb2_ani.gif

-rw-r--r-- 1 mysql mysql 216 1121 2004 back.gif

-rw-r--r-- 1 mysql mysql 308 1126 2008 back.png

-rw-r--r-- 1 mysql mysql 233 1121 2004 ball.gray.gif

-rw-r--r-- 1 mysql mysql 298 1126 2008 ball.gray.png

-rw-r--r-- 1 mysql mysql 205 1121 2004 ball.red.gif

-rw-r--r-- 1 mysql mysql 289 1126 2008 ball.red.png

-rw-r--r-- 1 mysql mysql 246 1121 2004 binary.gif

-rw-r--r-- 1 mysql mysql 310 1126 2008 binary.png

-------------- 생략 --------------

 

 

 

 

 

 

 

 

아파치의 헤더 파일이 저장된 디렉토리(/usr/local/apache/include )

 

 

아파치웹서버에 필요한 C헤더파일들이 존재하는 위치이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/include/

합계 1432

-rw-r--r-- 1 root root 1075 54 06:38 ap_compat.h

-rw-r--r-- 1 root root 9472 54 06:38 ap_config.h

-rw-r--r-- 1 root root 7335 54 06:38 ap_config_auto.h

-rw-r--r-- 1 root root 2710 54 06:38 ap_config_layout.h

-rw-r--r-- 1 root root 4167 54 06:38 ap_listen.h

-rw-r--r-- 1 root root 9714 54 06:38 ap_mmn.h

-rw-r--r-- 1 root root 8287 54 06:38 ap_mpm.h

-rw-r--r-- 1 root root 3086 54 06:38 ap_provider.h

-rw-r--r-- 1 root root 5344 54 06:38 ap_regex.h

-rw-r--r-- 1 root root 9124 54 06:38 ap_regkey.h

-rw-r--r-- 1 root root 2867 54 06:38 ap_release.h

-rw-r--r-- 1 root root 16795 54 06:38 apr.h

-------------- 생략 --------------

 

 

 

 

 

 

 

 

아파치 라이브러리가 저장된 디렉토리(/usr/local/apache/lib)

 

 

아파치웹서버에서 사용하는 여러가지 라이브러리파일들이 존재하는 위치이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/lib/

합계 3328

drwxr-xr-x 2 root root 4096 54 06:38 apr-util-1

-rw-r--r-- 1 root root 8367 54 06:38 apr.exp

-rw-r--r-- 1 root root 5254 54 06:38 aprutil.exp

-rw-r--r-- 1 root root 1345504 54 06:38 libapr-1.a

-rwxr-xr-x 1 root root 841 54 06:38 libapr-1.la

lrwxrwxrwx 1 root root 17 54 09:06 libapr-1.so -> libapr-1.so.0.4.6

lrwxrwxrwx 1 root root 17 54 09:06 libapr-1.so.0 -> libapr-1.so.0.4.6

-rwxr-xr-x 1 root root 720729 54 06:38 libapr-1.so.0.4.6

-rw-r--r-- 1 root root 818378 54 06:38 libaprutil-1.a

-rwxr-xr-x 1 root root 926 54 06:38 libaprutil-1.la

lrwxrwxrwx 1 root root 21 54 09:06 libaprutil-1.so -> libaprutil-1.so.0.4.1

lrwxrwxrwx 1 root root 21 54 09:06 libaprutil-1.so.0 -> libaprutil-1.so.0.4.1

-rwxr-xr-x 1 root root 466424 54 06:38 libaprutil-1.so.0.4.1

drwxr-xr-x 2 root root 4096 54 06:38 pkgconfig

 

 

 

 

 

 

 

 

man 페이지 파일이 저장된 디렉토리(/usr/local/apache/man)

 

 

아파치웹서버의 man페이지 파일들이 존재하는 위치이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# tree /usr/local/apache/man

/usr/local/apache/man

|-- man1

| |-- dbmmanage.1

| |-- htdbm.1

| |-- htdigest.1

| |-- htpasswd.1

| `-- httxt2dbm.1

`-- man8

|-- ab.8

|-- apachectl.8

|-- apxs.8

|-- htcacheclean.8

|-- httpd.8

|-- logresolve.8

|-- rotatelogs.8

`-- suexec.8

 

 

 

 

 

 

 

아파치를 컴파일하여 설치한 후에 아파치관련 명령어, 유틸리티들의 man페이지 파일이 보관되는 곳이다.

 

 

 

 

 

아파치 매뉴얼 파일이 저장된 디렉토리(/usr/local/apache/manual)

아파치웹서버의 매뉴얼파일이 존재하는 위치이다.

 

 

 

이 위치에는 아파치웹서버 운용에 필요한 여러가지 문서들이 언어별로 정리되어있다.

 

 

 

잘 확인해보면 매우 중요한 정보들을 얻을 수 있다.

 

 

 

아파치웹서버 관리자들이 필수적으로 보아야하는 페이지이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/manual/

합계 3304

-rw-r--r-- 1 root root 11358 1121 2004 LICENSE

-rw-r--r-- 1 root root 543 56 2008 bind.html

-rw-r--r-- 1 root root 13316 122 00:44 bind.html.de

-rw-r--r-- 1 root root 12132 122 00:44 bind.html.en

-rw-r--r-- 1 root root 13050 122 00:44 bind.html.fr

-rw-r--r-- 1 root root 14332 122 00:44 bind.html.ja.utf8

-rw-r--r-- 1 root root 10978 122 00:44 bind.html.ko.euc-kr

-rw-r--r-- 1 root root 12773 122 00:44 bind.html.tr.utf8

-rw-r--r-- 1 root root 297 714 2008 caching.html

-rw-r--r-- 1 root root 40971 122 00:44 caching.html.en

-rw-r--r-- 1 root root 46513 122 00:44 caching.html.fr

-rw-r--r-- 1 root root 45593 122 00:44 caching.html.tr.utf8

-rw-r--r-- 1 root root 585 56 2008 configuring.html

-rw-r--r-- 1 root root 16451 122 00:44 configuring.html.de

-rw-r--r-- 1 root root 15687 122 00:44 configuring.html.en

-rw-r--r-- 1 root root 16246 122 00:44 configuring.html.fr

-rw-r--r-- 1 root root 17113 122 00:44 configuring.html.ja.utf8

-rw-r--r-- 1 root root 13769 122 00:44 configuring.html.ko.euc-kr

-------------- 생략 --------------

 

 

 

 

 

이 매뉴얼페이지를 보면 한글로된 아파치 매뉴얼들이 있다.

 

 

 

 

 

 

이 파일을 보면 APACHE의 각종 기능들과 사용법들이 자세히 안내되어있다.

 

 

 

 

모듈 파일이 저장된 디렉토리(/usr/local/apache/modules)

 

 

 

아파치웹서버를 DSO방식으로 설치하였을 경우에 필요한 모듈파일들이 들어있는 위치이다.

 

 

 

 

 

 

 

 

[root@SULinux-64Bit apache]# ls -l /usr/local/apache/modules/

합계 22648

-rw-r--r-- 1 root root 9170 54 06:33 httpd.exp

-rwxr-xr-x 1 root root 23149676 56 11:16 libphp5.so

 

 

 

 

 

 

 

 

아파치에서 사용할 각종 모듈파일들을 직접 컴파일하거나 또는 생성된 모듈파일을 직접 가져와서 이 디렉토리에 저장해 두고 아파치 httpd.conf파일에서 LoadModule이라는 구문으로 불러서 사용하면 된다.

 

 

 

 

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,043 명
  • 현재 강좌수 :  35,853 개
  • 현재 접속자 :  80 명