관리 메뉴

새로운 시작, GuyV's lIfe sTyle.

아파치 가상호스트 설정 예제. 본문

ⓟrogramming

아파치 가상호스트 설정 예제.

가이브 2008.11.03 16:17
Apache virtual host..




Okay I got it going on my box just using localhost and listen on different ports.

The Document root had to start from root /var/www/html/...

In my directories I have
/var/www/html/test1/index.html
/var/www/html/test2/index.html

I configured appache to also listen to port 8000

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80
Listen 8000
Then modified the virtual hosts to point to the different folders...
NameVirtualHost *:80
NameVirtualHost *:8000
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/test1
ServerName test1.com
</VirtualHost>
<VirtualHost *:8000>
DocumentRoot /var/www/html/test2
ServerName test2.com
</VirtualHost>

Restart apache, open a browser and voila - http://localhost displays /test1/index.html and http://localhost:8000 displays /test2/index.html




- http://fedoraforum.org/forum/archive/index.php/t-147521.html

'ⓟrogramming' 카테고리의 다른 글

MySQL CSV 파일 import  (0) 2008.11.20
APM6 + XP Mysql 한글깨짐 해결  (0) 2008.11.20
아파치 가상호스트 설정 예제.  (0) 2008.11.03
[Rails] Controller -> View  (0) 2008.10.23
Ruby, 모델을 이용해 Select 하는 예제..  (0) 2008.10.02
레일즈 튜토리얼  (0) 2008.09.11
0 Comments
댓글쓰기 폼