|
|
|
¸®´ª½ºÆÁ Go Unix Power Tools Online Book
Go Bash Guide
|
|
Read No. 48 article |
2001-10-18 23:58:28 |
|
|
|
|
NickName |
Ç®ºñ´© |
Subject |
domain.com/~abd -> abc.domain.com À¸·Î |
|
|
mod_rewrite ¿Í Virtual User Hosts
±Û¾´ÀÌ : ÀÌ¿î¾ï (2001³â 10¿ù 05ÀÏ ¿ÀÀü 11:24) ÀÐÀº¼ö: 348
mod_rewrite ¿Í Virtual User Hosts
=================================
¿øÇÏ´Â °á°ú´Â "http://www.domain.com/~userid" ¸¦ »ç¿ëÄ¡ ¾Ê°í
"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 at 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>
|
|
Page Loading [ 0.04 Sec ]
SQL Time [ 0.01 Sec ]
|
|
|