가상 호스트 구성 문제
-
05-09-2019 - |
문제
몇 가지 세부 사항
- XAMPP 1.7.1
- Vista 및 XP에서 OS 테스트
여러분, 안녕하세요. 가상 호스트를 구성하는 데 몇 가지 문제가 있습니다. 현재 두 개의 사이트가 있습니다.
다음은 내 vhost.conf 파일입니다.
<VirtualHost *:80>
ServerAdmin me@site.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me@site.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
그리고 물론 내 호스트 파일에서 나는 가지고 있습니다
127.0.0.1 site1.local
127.0.0.1 site2.local
Apache와 브라우저를 여러 번 다시 시작했습니다.
여기 내 문제가 있습니다.
http : //site1.local 공장. 하지만 내가 갈 때 http : //site2.local, 나는 site1.local에 착륙합니다.
아이디어가 있습니까?
해결책
노력하다
<VirtualHost "site1.local">
ServerAdmin spam@a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site1/trunk/
ServerName site1.local
</VirtualHost>
<VirtualHost "site2.local">
ServerAdmin spam@a1230912##ad#.nl
DocumentRoot c:/xampp/htdocs/site2/trunk/
ServerName site2.local
</VirtualHost>
Apache가 첫 번째로 기본값이기 때문에 항상 Site1을 얻습니다.
편집하다
타협
#NameVirtualHost *
에게
NameVirtualHost *
httpd.conf에서
내 말은 (/etc/httpd/conf/httpd.conf)
126 # Listen: Allows you to bind Apache to specific IP addresses and/or
127 # ports, in addition to the default. See also the <VirtualHost>
128 # directive.
129 #
130 # Change this to Listen on specific IP addresses as shown below to
131 # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
132 #
133 Listen 127.0.0.1:80
134 NameVirtualHost 127.0.0.1
그리고 내 vhost 파일은 있습니다
<VirtualHost "www.whatever.com">
DocumentRoot /var/www/html/whatever/pub
ErrorLog logs/error_log
ServerName www.whatever.com
...
제휴하지 않습니다 StackOverflow