'user domain'에 해당되는 글 1건

블로그 정리중 글 옮김92009년 3월 26일 글)

apache 웹서버에서는 mod_rewrite 와 Virtual User Hosts 를 사용하여, 각 user들에게 도메인을 제공해줄 수 있습니다.

예를 들면, http://www.server.com/~userid로 접속을 하는 것을  http://userid.server.com 으로 서비스할 수 있습니다.

1. 네임서버 설정
해당하는 zone 파일의 호스트 이름에 "*" 문자(모든 호스트)를 사용
  * IN A 123.123.123.123

2. mod_rewrite 모듈 빌드 및 탑재
mod_rewrite.so 가 존재할 경우(apache의 모듈들이 설치된 디렉토리)에는 바로 httpd.conf를 수정하면 됩니다.

위의 모듈이 없을 경우, apache를 다시 빌드해야 합니다.
[root @ linux]# env CFLAGS="-DEAPI"
[root @ linux]#     ./configure
         --prefix=/etc/httpd
         --enable-module=so
         --enable-shared=max
         --enable-module=rewrite
         --enable-shared=rewrite

[root @ linux]# make
[root @ linux]# make install

3. httpd.conf 에 rewrite 관련 설정
  
LoadModule rewrite_module libexec/mod_rewrite.so
AddModule mod_rewrite.c
    ......
 
<VirtualHost *>
        ServerAdmin admin_at_domain.com
        DocumentRoot /home/httpd/html
        ServerName www.server.com
        ServerAlias domain.com *.server.com
        ErrorLog logs/server.com-error_log
        CustomLog logs/server.com-access_log common


        ### Virtual User Hosts


        RewriteEngine on


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


    



블로그 이미지

커뉴

이 세상에서 꿈 이상으로 확실한 것을, 인간은 가지고 있는 것일까?

,