2010-04-28 3 views
2

내 컴퓨터에 여러 개의 VirtalHost가 설정되어 있습니다. 나는 현재 내 comp의 IP 주소를 사용하는 다른 PC에서 작업하고있는 사이트를 방문하고 싶지만, 내가 시도한 모든 구성은 다른 가상 호스트 (실제로 내가 설정 한 첫 번째 가상 호스트 내 comp.). IP 주소가 내가 원하는 사이트로 이동하도록 아파치 가상 호스트 구성을 어떻게 설정합니까?localhost가 원하지 않을 것입니다. VirtualHost

/etc/apache2/sites-available/site-i-want-to-show-up-with-ip-address.conf에는 다음이 포함

<VirtualHost *:80> 
ServerAdmin [email protected] 

ServerAlias currentsite.com 

DocumentRoot /path/to/root/of/site-i-want-to-show-up 
ServerName localhost 

ScriptAlias /awstats/ /usr/lib/cgi-bin/ 

CustomLog /var/log/apache2/current-site-access.log combined 
</VirtualHost> 

및/etc/아파치/사이트-가능 /site-that-keeps-showing-up.conf에는 다음이 포함

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerAlias theothersite.com 
    DocumentRoot /path/to/it 
    <Directory /> 
     Options FollowSymLinks 
     AllowOverride None 
    </Directory> 

</VirtualHost> 

내가 누구의 도움을 주셔서 감사합니다 것입니다.

또한 웹 서버 구성에 대해서는 잘 모르고 위의 코드를 얻으려면 자습서를 사용했습니다.

+0

지금은 사용 중입니다. (98) 주소가 이미 사용 중입니다. make_sock : 주소 [:]에 바인딩 할 수 없습니다. : 012 – ladaghini

답변

2

Apache 2.x Virtual Hosts

1) 당신은 당신의에서 VirtualHost 섹션이 사전이 필요합니다

# Ensure that Apache listens on port 80 
Listen 80 

# Listen for virtual host requests on all IP addresses 
NameVirtualHost *:80 

2) 각 섹션은 DocumentRoot에 필요 및 ServerName 항목 :

<VirtualHost 172.20.30.50> 
DocumentRoot /www/example1 
ServerName www.example1.com 

# Other directives here ... 

</VirtualHost> 
0

도/etc/hosts 파일에 하나를 추가

127.0.0.1 theothersite.com 
+0

다른 PC에서 사이트에 액세스하고 있습니다. 호스트의이 항목은 사용중인 호스트의 항목입니다. 로컬 PC에서 명명 된 호스트. – danivovich

1

named virtual hosts이 켜져 있는지 확인하십시오. 그런 다음 다른 컴퓨터에서 호스트 파일을 설정하여 두 도메인에 액세스 할 때 서버의 IP로 이동해야합니다.

ip.addr.x.y currentsize.com 
ip.addr.x.y theothersite.com 
# ip.addr.x.y is the ip of the pc with apache, this file goes on your other pc 
당신은 사용할 수 없습니다

당신이 여러 IP의 필요와 각 IP에 각각의 가상 호스트를 설정 거라고 할, IP 주소를 통해 액세스 할 경우 이름

<VirtualHost ip.addr.x.y:80> 
# one of the two IP addresses bound to the pc with apache on it 
</VirtualHost> 

<VirtualHost ip.addr.x.z:80> 
# the other of the two IP addresses bound to the pc with apache on it 
</VirtualHost> 
같은 가상 호스트를 기반으로

요청에 이름을 지정하지 않으면 처음 구성된 가상 호스트 이름이 사용됩니다.

관련 문제