  | 
	
 | 	
	  | 
	
	
		
	  |  
	| 
	
	 |  
	 
		
		
			
				
				- 1. 개요
 
				웹호스팅 서비스의 경우 서비스 사양에 "일일 트래픽 500M" 혹은 "일일 히트수 1000 히트 제한" 등의 내용이 있다. 
				주로 트래픽(데이터 전송량)을 이용하여 각 계정별로 사용량을 제한하는 방법을 사용하는데 이 때 사용하는 것이 mod_throttle 모듈이다.
  
				2. 다운로드 및 설치 
				(1) 소스 구하기 
				ftp://ftp.superuser.co.kr/etc/mod_throttle312.tgz 에서 파일을 구할 수 있다.
  
				아래 명령을 수행하여 다운로드 및 압축을 푼다. 
				[root@www ~] wget ftp://ftp.superuser.co.kr/etc/mod_throttle312.tgz 
				[root@www ~] tar xzvfp mod_throttle312.tgz 
				다운받아 압축을 풀면 여러개의 파일이 나오는데 그 중에서 mod_throttle.c 파일을 /usr/local/apache/src/module/extra 디렉터리로 복사해 놓는다.
  
				(2) 아파치 컴파일 
				- 아파치를 컴파일할 때 아래 옵션을 넣어 컴파일한다. 
				[root@www apache]# ./configure --prefix=/usr/local/apache \ 
				--activate-module=src/modules/php4/libphp4.a \ 
				--add-module=src/modules/extra/mod_throttle.c
  
				- 아래 명령을 수행하여 설치를 마무리한다. 
				[root@www apache]# make 
				[root@www apache]# make install
  
				(3) 설치 확인 
				[root@myserver apache]# /usr/local/apache/bin/httpd -l 
				Compiled-in modules: 
				http_core.c 
				mod_env.c 
				mod_log_config.c 
				mod_mime.c 
				mod_negotiation.c 
				mod_status.c 
				mod_include.c 
				mod_autoindex.c 
				mod_dir.c 
				mod_cgi.c 
				mod_asis.c 
				mod_imap.c 
				mod_actions.c 
				mod_userdir.c 
				mod_alias.c 
				mod_access.c 
				mod_auth.c 
				mod_setenvif.c 
				mod_php4.c 
				mod_throttle.c 
				suexec: disabled; invalid wrapper /usr/local/apache/bin/suexec
  
				mod_throttle.c 라는 항목이 보이면 mod_throttle이 정상적으로 설치가 된 것이다.
  
				3. 상세 설정 
				- httpd.conf에 다음 항목을 추가한다.
  
				ThrottlePolicy none 
				SetHandler throttle-status 
				Deny from all // 다른접근을 모두 거부하고 
				Allow from 123.123.123.123 // 특정 아이피에서만 throttle-status 를 확인하도록 설정. 클래스 단위로도 설정이 가능하다. 
				SetHandler throttle-me 
				Order deny,allow 
				Deny from all 
				Allow from all 
				SetHandler throttle-me
  
				* Allow from IP 항목을 넣어 놓아야 관리자만 트래픽 상태를 확인 및 초기화가 가능하다.
  
				- virtualhost 부분의 설정 (Throttle Policy 부분의 줄을 추가한다)
  
				ServerAdmin dream@praise.co.kr 
				DocumentRoot /home/dream/public_html 
				ServerName myserver.co.kr 
				ServerAlias www.myserver.co.kr 
				ThrottlePolicy Volume 1024M 1d -> 1일 1G 제한 
				ThrottlePolicy Request 1000 1d -> 하루 히트수 1000회 제한 
				ErrorLog /var/log/httpd/error_log 
				CustomLog /var/log/httpd/access_log common
  
				* 설정이 다 되면 아파치 데몬을 재구동해야 적용된다. 
				* 만약 트래픽을 하루 단위가 아닌 한 주나 1개월로 설정할 경우에는 1d를 1w (한 주) 또는 1m (한 달)로 바꾸어 주면 된다.
  
				4. 확인 
				- httpd.conf에서 Allow from으로 지정한 IP에서 접속 후 브라우저 주소창에 http://자기도메인/throttle-status 로 접속하면 해당 서버의 트래픽 총 현황 확인이  
				가능하며 
				- http://자기도메인/throttle-me 로 접속하면 자기 도메인에서의 트래픽 용량 설정 및 현재까지의 사용량을 확인할 수 있다. 
			   |  
			  | 
	 |  
 
								
	
						 |