简体   繁体   中英

Using multiple sites in virtual hosts (apache)

I have installed XAMPP on my windows box - I am trying to run multiple websites in the virtual hosts file but no matter I seem to do I can only run one site at a time. eg to run site three i need to comment out all references to site 1 & 2 (and vice-versa).

Can anyone explain what I am doing wrong?

My v/hosts file is as follows:

<VirtualHost *:80>
ServerName s1.localhost
ServerAlias s1.localhost
DocumentRoot "C:/xampp/htdocs/site1/public_html"
<Directory "C:/xampp/htdocs/site1/public_html">
    AllowOverride All
   Options FollowSymlinks
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
ServerName s2.localhost
ServerAlias s2.localhost
DocumentRoot "C:/xampp/htdocs/site2/public_html"
<Directory "C:/xampp/htdocs/site2/public_html">
    AllowOverride All
    Options FollowSymlinks
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
ServerName s3.localhost
ServerAlias s3.localhost
DocumentRoot "C:/xampp/htdocs/site3"
<Directory "C:/xampp/htdocs/site3">
    AllowOverride All
    Options FollowSymlinks
    Order allow,deny
    Allow from all
</Directory>

My Windows Host file:

127.0.0.1 s1.localhost
127.0.0.1 s2.localhost
127.0.0.1 s3.localhost

NameVirtualHost *:80-此行需要取消注释才能解决此问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM