Apache에서 대량 가상 호스팅을 수행하려고합니다. 여기에서 당신은 어떻게 할 수있는 정보를 찾을 것이다 : 당신이 연결 한 튜토리얼에서 예를 바탕으로
Dynamically configured mass virtual hosting
:
NameVirtualHost *
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "C:\Documents and Settings\Me\My Documents\clientA\website"
ServerName clientA.local
<Directory "C:\Documents and Settings\Me\My Documents\clientA\website">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
DocumentRoot "C:\Documents and Settings\Me\My Documents\clientB\website"
ServerName clientB.local
<Directory "C:\Documents and Settings\Me\My Documents\clientB\website">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
이 구성에 관한 문제는 정적하다는이고, Apache를 변경하면 다시 시작해야합니다.
먼저 DNS 서버에 모든 하위 도메인을 서버에 매핑하는 레코드가 필요합니다. 이처럼 :
*.local. 3600 IN A x.x.x.x
로컬 호스트에서이를 테스트하려면, 당신은 수동으로 hosts
파일에 일부 하위 도메인을 설정할 수 있습니다. hosts
파일에서 와일드 카드 하위 도메인을 설정할 수없는 이유는 here을 참조하십시오.
는 httpd.conf 파일에 vhost_alias_module를로드하는 것을 잊지 마세요 :
LoadModule vhost_alias_module modules/mod_vhost_alias.so
그런 다음이 예와 같이, 가상 호스트 설정을 대체합니다 :
<VirtualHost *>
# get the server name from the Host: header
UseCanonicalName Off
# this log format can be split per-virtual-host based on the first field
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot "C:/Documents and Settings/Me/My Documents/%1/website"
<Directory "C:/Documents and Settings/Me/My Documents/*/website">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
DirectoryIndex index.php index.html index.htm
</Directory>
</VirtualHost>
이 설정 와일드 카드를 사용합니다 요구 된 서브 도메인의 문서 루트.
모든 사용자에 대해 하위 도메인을 설정하려는 이유는 무엇입니까? 목적은 무엇입니까? 웹 호스팅? – LucasF
@ 루카스 예, 웹 호스팅 –
이 질문은 [ServerFault] (http://serverfault.com/)에 게시되어야합니다 ... –