'운영체제(OS)/Linux'에 해당되는 글 2건

  1. 2011.02.12 Ubuntu 서버에서 dns와 Bind9설정하는 법
  2. 2009.12.31 Virtual User Host 라는 것
0. dns  설정하기

다음과 같이 resolv.conf파일을 이용하면 됩니다.

- search 기본적으로 먼저 찾아야 할 Hostname을 위한 domain 이름을 적어줍니다.
  보통 설정하는 호스트의 domain.name을 적어주면 되겠죠. 

$ sudo vi /etc/resolv.conf   
search tera terawords.com
nameserver 222.231.1.100
nameserver 222.231.2.251
nameserver 222.231.3.251


1. bind9 설치 (named설치)

$ sudo apt-get install bind9


2. Zone을 등록합니다.

$ sudo nano /etc/bind/named.conf.local

//
// Do any local configuration here
//
zone "terawords.com" {
        type master;
        file "/etc/bind/db.terawords.com";
};

3. Zone파일을 편집합니다.

$ sudo cp /etc/bind/db.local /etc/bind/db.terawords.com

$ sudo nano /etc/bind/db.terawords.com

$ vi /etc/bind/db.terawords.com

;
; BIND data file for local loopback interface
;
; 도메인 주소 뒤에 ' . ' 주의!!

$TTL    604800
@       IN      SOA     ns.terawords.comroot.terawords.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns.terawords.com.
@       IN      A       211.233.81.91
www  IN      A       211.233.81.91
mail    IN      A       211.233.81.91
*        IN      A       211.233.81.91

$ sudo /etc/init.d/bind9 restart

'운영체제(OS) > Linux' 카테고리의 다른 글

Virtual User Host 라는 것  (0) 2009.12.31
Posted by tuxxon
0. 목적.
-------
"http://www.domain.com/~userid" 라는 URL 대신에
"http://userid.domain.com" 으로 바꿔서 서비스를 제공하려는 것입니다.

의외로 찾기가 힘들군요.
어쨌든 하나 찾아서, 다시 정리해서 올립니다.

간단히 3단계로 나눌수 있습니다.

1. 네임서버 설정
2. mod_rewrite 모듈 탑재
3. httpd.conf 에 rewrite 관련 설정


1. 네임서버 설정
----------------

해당하는 zone 파일에서 호스트 이름에 "*" 문자를 사용합니다.

* IN A 111.2.333.4


2. mod_rewrite 모듈 탑재
------------------------

a) 아파치의 모듈들이 설치된 디렉토리에 mod_rewrite.so 가 존재할 경우.

c) 로 건너 띄면 됩니다 ^^;

b) 아파치의 모듈들이 설치된 디렉토리에 mod_rewrite.so 가 없는 경우.

apache 를 다시 컴파일 합니다.

env CFLAGS="-DEAPI"
./configure
--prefix=/etc/httpd
--enable-module=so
--enable-shared=max
--enable-module=rewrite
--enable-shared=rewrite


make
make install

c) httpd.conf 에서 다음을 확인합니다.

LoadModule rewrite_module libexec/mod_rewrite.so
AddModule mod_rewrite.c


3. httpd.conf 에 rewrite 관련 설정
----------------------------------

<VirtualHost *>
ServerAdmin admin@domain.com
DocumentRoot /home/httpd/html
ServerName www.domain.com
ServerAlias domain.com *.domain.com
ErrorLog logs/domain.com-error_log
CustomLog logs/domain.com-access_log common

### Virtual User Hosts

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www.domain.com$
RewriteCond %{HTTP_HOST} !^domain.com$
RewriteCond %{HTTP_HOST} ^[^.]+.domain.com$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+).domain.com(.*) /home/$1/html$2
</VirtualHost>

'운영체제(OS) > Linux' 카테고리의 다른 글

Ubuntu 서버에서 dns와 Bind9설정하는 법  (0) 2011.02.12
Posted by tuxxon
이전버튼 1 이전버튼

블로그 이미지
소프트웨어 개발자로서, 세상에 살아가는 과정을 그려보고 싶습니다. 그냥 즐겁게 봐주시기 바랍니다.
tuxxon

공지사항

Yesterday
Today
Total

달력

 « |  » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

최근에 올라온 글

최근에 달린 댓글

글 보관함