리눅스마스터1급 : 웹 서버 설정하기
작성자 정보
- 관리자 작성
- 작성일
컨텐츠 정보
- 2,822 조회
- 0 추천
- 목록
본문
리눅스마스터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 5월 4 06:38 ab -rwxr-xr-x 1 root root 3425 5월 4 06:27 apachectl -rwxr-xr-x 1 root root 6986 5월 4 06:38 apr-1-config -rwxr-xr-x 1 root root 6456 5월 4 06:38 apu-1-config -rwxr-xr-x 1 root root 22652 5월 4 06:27 apxs -rwxr-xr-x 1 root root 12694 5월 4 06:38 checkgid -rwxr-xr-x 1 root root 8925 5월 4 06:27 dbmmanage -rw-r--r-- 1 root root 1071 5월 4 06:27 envvars -rw-r--r-- 1 root root 1071 5월 4 06:27 envvars-std -rwxr-xr-x 1 root root 44226 5월 4 06:38 htcacheclean -rwxr-xr-x 1 root root 30962 5월 4 06:38 htdbm -rwxr-xr-x 1 root root 22010 5월 4 06:38 htdigest -rwxr-xr-x 1 root root 30847 5월 4 06:38 htpasswd -rwxr-xr-x 1 root root 2969595 5월 4 06:38 httpd -rwxr-xr-x 1 root root 20723 5월 4 06:38 httxt2dbm -rwxr-xr-x 1 root root 22111 5월 4 06:38 logresolve -rwxr-xr-x 1 root root 25037 5월 4 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 5월 4 06:49 access_log -rw-r--r-- 1 root root 547 5월 6 11:31 error_log -rw-r--r-- 1 root root 5 5월 6 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 11월 21 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 5월 4 06:38 extra -rw-r--r-- 1 root root 13659 5월 6 11:16 httpd.conf -rw-r--r-- 1 root root 13659 5월 6 11:16 httpd.conf.bak -rw-r--r-- 1 root root 12958 5월 4 06:38 magic -rw-r--r-- 1 root root 53011 5월 4 06:38 mime.types drwxr-xr-x 3 root root 4096 5월 4 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 5월 4 06:38 httpd-autoindex.conf -rw-r--r-- 1 root root 1713 5월 4 06:38 httpd-dav.conf -rw-r--r-- 1 root root 2344 5월 4 06:38 httpd-default.conf -rw-r--r-- 1 root root 1103 5월 4 06:38 httpd-info.conf -rw-r--r-- 1 root root 5078 5월 4 06:38 httpd-languages.conf -rw-r--r-- 1 root root 916 5월 4 06:38 httpd-manual.conf -rw-r--r-- 1 root root 3789 5월 4 06:38 httpd-mpm.conf -rw-r--r-- 1 root root 2183 5월 4 06:38 httpd-multilang-errordoc.conf -rw-r--r-- 1 root root 11049 5월 4 06:38 httpd-ssl.conf -rw-r--r-- 1 root root 817 5월 4 06:38 httpd-userdir.conf -rw-r--r-- 1 root root 1491 5월 4 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 12월 11 2004 printenv -rw-r--r-- 1 mysql mysql 779 12월 11 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 12월 9 2010 HTTP_BAD_GATEWAY.html.var -rw-r--r-- 1 mysql mysql 6902 12월 9 2010 HTTP_BAD_REQUEST.html.var -rw-r--r-- 1 mysql mysql 11736 12월 9 2010 HTTP_FORBIDDEN.html.var -rw-r--r-- 1 mysql mysql 13420 12월 28 2010 HTTP_GONE.html.var -rw-r--r-- 1 mysql mysql 13403 12월 28 2010 HTTP_INTERNAL_SERVER_ERROR.html.var -rw-r--r-- 1 mysql mysql 7944 12월 28 2010 HTTP_LENGTH_REQUIRED.html.var -rw-r--r-- 1 mysql mysql 7080 12월 28 2010 HTTP_METHOD_NOT_ALLOWED.html.var -rw-r--r-- 1 mysql mysql 13566 12월 28 2010 HTTP_NOT_FOUND.html.var -rw-r--r-- 1 mysql mysql 6627 12월 28 2010 HTTP_NOT_IMPLEMENTED.html.var -rw-r--r-- 1 mysql mysql 6861 12월 28 2010 HTTP_PRECONDITION_FAILED.html.var -rw-r--r-- 1 mysql mysql 8165 12월 9 2010 HTTP_REQUEST_ENTITY_TOO_LARGE.html.var -rw-r--r-- 1 mysql mysql 7371 12월 9 2010 HTTP_REQUEST_TIME_OUT.html.var -rw-r--r-- 1 mysql mysql 7385 12월 9 2010 HTTP_REQUEST_URI_TOO_LARGE.html.var -rw-r--r-- 1 mysql mysql 8233 12월 9 2010 HTTP_SERVICE_UNAVAILABLE.html.var -rw-r--r-- 1 mysql mysql 13557 12월 28 2010 HTTP_UNAUTHORIZED.html.var -rw-r--r-- 1 mysql mysql 6626 12월 9 2010 HTTP_UNSUPPORTED_MEDIA_TYPE.html.var -rw-r--r-- 1 mysql mysql 7374 12월 28 2010 HTTP_VARIANT_ALSO_VARIES.html.var -rw-r--r-- 1 mysql mysql 1979 7월 12 2006 README -rw-r--r-- 1 mysql mysql 4245 12월 28 2010 contact.html.var drwxr-xr-x 2 mysql mysql 4096 2월 21 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 8월 28 2007 README -rw-r--r-- 1 mysql mysql 36057 8월 28 2007 README.html -rw-r--r-- 1 mysql mysql 246 11월 21 2004 a.gif -rw-r--r-- 1 mysql mysql 306 11월 26 2008 a.png -rw-r--r-- 1 mysql mysql 242 11월 21 2004 alert.black.gif -rw-r--r-- 1 mysql mysql 293 11월 26 2008 alert.black.png -rw-r--r-- 1 mysql mysql 247 11월 21 2004 alert.red.gif -rw-r--r-- 1 mysql mysql 314 11월 26 2008 alert.red.png -rw-r--r-- 1 mysql mysql 2326 11월 21 2004 apache_pb.gif -rw-r--r-- 1 mysql mysql 2088 11월 26 2008 apache_pb.png -rw-r--r-- 1 mysql mysql 1797 11월 26 2008 apache_pb2.gif -rw-r--r-- 1 mysql mysql 1505 11월 26 2008 apache_pb2.png -rw-r--r-- 1 mysql mysql 2434 11월 26 2008 apache_pb2_ani.gif -rw-r--r-- 1 mysql mysql 216 11월 21 2004 back.gif -rw-r--r-- 1 mysql mysql 308 11월 26 2008 back.png -rw-r--r-- 1 mysql mysql 233 11월 21 2004 ball.gray.gif -rw-r--r-- 1 mysql mysql 298 11월 26 2008 ball.gray.png -rw-r--r-- 1 mysql mysql 205 11월 21 2004 ball.red.gif -rw-r--r-- 1 mysql mysql 289 11월 26 2008 ball.red.png -rw-r--r-- 1 mysql mysql 246 11월 21 2004 binary.gif -rw-r--r-- 1 mysql mysql 310 11월 26 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 5월 4 06:38 ap_compat.h -rw-r--r-- 1 root root 9472 5월 4 06:38 ap_config.h -rw-r--r-- 1 root root 7335 5월 4 06:38 ap_config_auto.h -rw-r--r-- 1 root root 2710 5월 4 06:38 ap_config_layout.h -rw-r--r-- 1 root root 4167 5월 4 06:38 ap_listen.h -rw-r--r-- 1 root root 9714 5월 4 06:38 ap_mmn.h -rw-r--r-- 1 root root 8287 5월 4 06:38 ap_mpm.h -rw-r--r-- 1 root root 3086 5월 4 06:38 ap_provider.h -rw-r--r-- 1 root root 5344 5월 4 06:38 ap_regex.h -rw-r--r-- 1 root root 9124 5월 4 06:38 ap_regkey.h -rw-r--r-- 1 root root 2867 5월 4 06:38 ap_release.h -rw-r--r-- 1 root root 16795 5월 4 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 5월 4 06:38 apr-util-1 -rw-r--r-- 1 root root 8367 5월 4 06:38 apr.exp -rw-r--r-- 1 root root 5254 5월 4 06:38 aprutil.exp -rw-r--r-- 1 root root 1345504 5월 4 06:38 libapr-1.a -rwxr-xr-x 1 root root 841 5월 4 06:38 libapr-1.la lrwxrwxrwx 1 root root 17 5월 4 09:06 libapr-1.so -> libapr-1.so.0.4.6 lrwxrwxrwx 1 root root 17 5월 4 09:06 libapr-1.so.0 -> libapr-1.so.0.4.6 -rwxr-xr-x 1 root root 720729 5월 4 06:38 libapr-1.so.0.4.6 -rw-r--r-- 1 root root 818378 5월 4 06:38 libaprutil-1.a -rwxr-xr-x 1 root root 926 5월 4 06:38 libaprutil-1.la lrwxrwxrwx 1 root root 21 5월 4 09:06 libaprutil-1.so -> libaprutil-1.so.0.4.1 lrwxrwxrwx 1 root root 21 5월 4 09:06 libaprutil-1.so.0 -> libaprutil-1.so.0.4.1 -rwxr-xr-x 1 root root 466424 5월 4 06:38 libaprutil-1.so.0.4.1 drwxr-xr-x 2 root root 4096 5월 4 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 11월 21 2004 LICENSE -rw-r--r-- 1 root root 543 5월 6 2008 bind.html -rw-r--r-- 1 root root 13316 1월 22 00:44 bind.html.de -rw-r--r-- 1 root root 12132 1월 22 00:44 bind.html.en -rw-r--r-- 1 root root 13050 1월 22 00:44 bind.html.fr -rw-r--r-- 1 root root 14332 1월 22 00:44 bind.html.ja.utf8 -rw-r--r-- 1 root root 10978 1월 22 00:44 bind.html.ko.euc-kr -rw-r--r-- 1 root root 12773 1월 22 00:44 bind.html.tr.utf8 -rw-r--r-- 1 root root 297 7월 14 2008 caching.html -rw-r--r-- 1 root root 40971 1월 22 00:44 caching.html.en -rw-r--r-- 1 root root 46513 1월 22 00:44 caching.html.fr -rw-r--r-- 1 root root 45593 1월 22 00:44 caching.html.tr.utf8 -rw-r--r-- 1 root root 585 5월 6 2008 configuring.html -rw-r--r-- 1 root root 16451 1월 22 00:44 configuring.html.de -rw-r--r-- 1 root root 15687 1월 22 00:44 configuring.html.en -rw-r--r-- 1 root root 16246 1월 22 00:44 configuring.html.fr -rw-r--r-- 1 root root 17113 1월 22 00:44 configuring.html.ja.utf8 -rw-r--r-- 1 root root 13769 1월 22 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 5월 4 06:33 httpd.exp -rwxr-xr-x 1 root root 23149676 5월 6 11:16 libphp5.so |
|
|
|
|
아파치에서 사용할 각종 모듈파일들을 직접 컴파일하거나 또는 생성된 모듈파일을 직접 가져와서 이 디렉토리에 저장해 두고 아파치 httpd.conf파일에서 LoadModule이라는 구문으로 불러서 사용하면 된다.
관련자료
-
이전
-
다음