최근 Ubuntu linux에서 Apache HTTP Server 2.2를 설치 사용할 일이 있었다.
다른 설정 관련: 2009/07/15 - [Soft] - Apache HTTP Server 2.2 설정 - httpd.conf
오래 전과 달리 (필자가 최근에 업데이트를 안 해서) 최근 Apache는 많은 module들을 default로 enable시키지 않아 해당 module을 사용하려고 하면 다음과 형태의 error 메세지가 출력된다.
여기서는 우선 user home directory설정 관련 module을 enable시키는 방법을 설명한 후 일반적으로 module들을 활성화 시키는 방법을 설명하기로 한다.
Apache에서 많이 사용하는 기능임녀서도 enable되지 않는 대표적인 예로 user home director를 지정하는 설정 부분이다. default로 설치하면 user home directory를 설정하는 module이 load되지 않아 UserDir directive가 다음과 같은 에러 메세지를 출력하면서 인식되지 않았다.
그래서 이에 대한 해결방법을 여기 기록하면서 몇 가지 자주 쓰는 명령어를 기록해 보았다.
여기서는 apache2의 설정 파일이 다음 위치에 있을 때를 가정한다.
1. User-sepcific directory 설정 방법
/etc/apache2/httpd.conf에 다음을 추가한다.
이제 다음 명령으로 apache를 재시작한다.
2. How to enable apache modules
다음과 같이 directive(지시어)에 대한 error message가 나오면 대부분의 경우 module이 설치되어 있지만 enable이 안 되어 있는 경우이다.
Apache에서 사용가능한 module의 크게 2가지 부류가 있다.
우선 (1) apache가 compile될 때 이미 포함된 module, 그리고 (2) apache가 수행될 때 불러들이는 module이다.
apache가 compile될 때 이미 포함된 module은 다음 명령으로 확인할 수 있다.
수행중에 불러들일 수 있는 module (availalble module)과 이미 enable된 module (enabled module)은 다음 경로에서 확인할 수 있다.
/etc/apache2/mods-enabled를 살펴보면 mods-available에 있는 파일을 ln명령을 이용해서 symbolic link시킨 것이다. 그리고 apache2.conf파일을 살펴보면 다음과 같은 부분이 있어 mods-enabled에 있는 모든 module을 enable시키고 있다.
앞에서 UserDir의 경우처럼 module이 설치되어 /etc/apache2/mods-available에는 존재하지만 enable되지 않아 module이 load가 되지 않아 사용하지 못하는 directive(지시어)들이 있을 때 module을 enable시키는 방법은 다음과 같이 크게 2가지가 있다.
2.1 httpd.conf를 이용한 방법
앞에서 UserDir을 해겷라 때 사용한 밥법으로 /etc/apache2/mods-available에 있는 *.load, *.conf 파일을 위에서 소개한 방법처럼 http.conf에서 불러들이는 방법이다.
2.2 apache의 설정 방법
/etc/apache2/mods-available에 있는 설정 파일을 mods-enabled에서 symbolic link를 시키는 방법이다.
참고출처: How To: Enable apache modules under Debian based system
3. apache stop/restart
기본적으로 apache2ctl, apachectl로 작성되어있는 script를 이용해서 수행하면 되며 자주 사용되는 것은 다음과 같다.
apachectl -k stop # stop now
apachectl -k graceful # graceful restart (재시작시 권장되는 명령임)
apachectl -k restart # restart now
apachectl -k graceful-stop # graceful stop
참고문헌: Apache HTTP Server Version 2.2 Documentation
다른 설정 관련: 2009/07/15 - [Soft] - Apache HTTP Server 2.2 설정 - httpd.conf
오래 전과 달리 (필자가 최근에 업데이트를 안 해서) 최근 Apache는 많은 module들을 default로 enable시키지 않아 해당 module을 사용하려고 하면 다음과 형태의 error 메세지가 출력된다.
Invalid command 'UserDir', perhaps misspelled or defined by a module not included in the server configuration
('UserDir' 부분은 사용자가 사용하려는 directive에 따라서 바뀐다.)여기서는 우선 user home directory설정 관련 module을 enable시키는 방법을 설명한 후 일반적으로 module들을 활성화 시키는 방법을 설명하기로 한다.
Apache에서 많이 사용하는 기능임녀서도 enable되지 않는 대표적인 예로 user home director를 지정하는 설정 부분이다. default로 설치하면 user home directory를 설정하는 module이 load되지 않아 UserDir directive가 다음과 같은 에러 메세지를 출력하면서 인식되지 않았다.
$ apache2ctl -k graceful
Invalid command 'UserDir', perhaps misspelled or defined by a module not included in the server configuration
$
Invalid command 'UserDir', perhaps misspelled or defined by a module not included in the server configuration
$
그래서 이에 대한 해결방법을 여기 기록하면서 몇 가지 자주 쓰는 명령어를 기록해 보았다.
여기서는 apache2의 설정 파일이 다음 위치에 있을 때를 가정한다.
기본 설정 파일: /etc/apache2/apache2.conf
추가 설정 파일: /etc/apache2/httpd.conf (apache2.conf에서 include됨)
설치된 module에 대한 설정 파일 위치 : /etc/apache2/mods-available/
수행 중인 module에 대한 설정 파일 위치 : /etc/apache2/mods-enabled/
추가 설정 파일: /etc/apache2/httpd.conf (apache2.conf에서 include됨)
설치된 module에 대한 설정 파일 위치 : /etc/apache2/mods-available/
수행 중인 module에 대한 설정 파일 위치 : /etc/apache2/mods-enabled/
1. User-sepcific directory 설정 방법
/etc/apache2/httpd.conf에 다음을 추가한다.
Include /etc/apache2/mods-available/userdir.load
Include /etc/apache2/mods-available/userdir.conf
Include /etc/apache2/mods-available/userdir.conf
이제 다음 명령으로 apache를 재시작한다.
$ apache2ctl -k graceful
참고로 userdir.load와 userdir.conf의 내용을 확인해보면 각각 다음과 같으며 미리 작성된 것과 다른 설정을 원한다면 복사한 후 수정해서 사용하면 된다.
LoadModule userdir_module /usr/lib/apache2/modules/mod_userdir.so
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>
</IfModule>
2. How to enable apache modules
다음과 같이 directive(지시어)에 대한 error message가 나오면 대부분의 경우 module이 설치되어 있지만 enable이 안 되어 있는 경우이다.
Invalid command 'XXXXXXX', perhaps misspelled or defined by a module not included in the server configuration
(XXXXXX는 설정파일에 추가한 directive(지시어))
(XXXXXX는 설정파일에 추가한 directive(지시어))
Apache에서 사용가능한 module의 크게 2가지 부류가 있다.
우선 (1) apache가 compile될 때 이미 포함된 module, 그리고 (2) apache가 수행될 때 불러들이는 module이다.
apache가 compile될 때 이미 포함된 module은 다음 명령으로 확인할 수 있다.
$ apache2 -l
수행중에 불러들일 수 있는 module (availalble module)과 이미 enable된 module (enabled module)은 다음 경로에서 확인할 수 있다.
/etc/apache2/mods-available: apache2 설치시 설치된 module
/etc/apache2/mods-enabled : 현재 기본으로 apache2에서 사용 중인 module
/etc/apache2/mods-enabled : 현재 기본으로 apache2에서 사용 중인 module
/etc/apache2/mods-enabled를 살펴보면 mods-available에 있는 파일을 ln명령을 이용해서 symbolic link시킨 것이다. 그리고 apache2.conf파일을 살펴보면 다음과 같은 부분이 있어 mods-enabled에 있는 모든 module을 enable시키고 있다.
# apache2.conf 에서 enabled module을 불러들이는 부분
# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
앞에서 UserDir의 경우처럼 module이 설치되어 /etc/apache2/mods-available에는 존재하지만 enable되지 않아 module이 load가 되지 않아 사용하지 못하는 directive(지시어)들이 있을 때 module을 enable시키는 방법은 다음과 같이 크게 2가지가 있다.
2.1 httpd.conf를 이용한 방법
앞에서 UserDir을 해겷라 때 사용한 밥법으로 /etc/apache2/mods-available에 있는 *.load, *.conf 파일을 위에서 소개한 방법처럼 http.conf에서 불러들이는 방법이다.
Include /etc/apache2/mods-available/userdir.load
Include /etc/apache2/mods-available/userdir.conf
Include /etc/apache2/mods-available/userdir.conf
2.2 apache의 설정 방법
/etc/apache2/mods-available에 있는 설정 파일을 mods-enabled에서 symbolic link를 시키는 방법이다.
( mime_magic module을 enable 시키는 예제)
$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/mime_magic.conf mime_magic.conf
$ sudo ln -s ../mods-available/mime_magic.load mime_magic.load
$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/mime_magic.conf mime_magic.conf
$ sudo ln -s ../mods-available/mime_magic.load mime_magic.load
참고출처: How To: Enable apache modules under Debian based system
3. apache stop/restart
기본적으로 apache2ctl, apachectl로 작성되어있는 script를 이용해서 수행하면 되며 자주 사용되는 것은 다음과 같다.
apachectl -k stop # stop now
apachectl -k graceful # graceful restart (재시작시 권장되는 명령임)
apachectl -k restart # restart now
apachectl -k graceful-stop # graceful stop
참고문헌: Apache HTTP Server Version 2.2 Documentation
'Soft' 카테고리의 다른 글
| APM Setup 6 (Apache, PHP, MySQL) (0) | 2009/07/14 |
|---|---|
| scp, script, tee (0) | 2009/07/14 |
| Apache HTTP Server 2.2 설정 - Module (모듈 관리) (1) | 2009/07/03 |
| [필수유틸] Total Commander (토탈 커맨더) - 10년이 넘는 기간 동안 필수 유틸 (0) | 2009/06/16 |
| LCD Monitor setting w/ Nokia Moniter Test (노키아 모니터 테스트) (0) | 2009/06/08 |
| [링크] unix / linux 사용자 및 개발자를 위한 문서 (1) | 2009/05/27 |

Prev

