简体   繁体   中英

Access to multiple websites from different domains

Let's say I've two directories in my Linux Vargant box system:

/var/www/public/web1/

/var/www/public/web2/

In this Vargant Linux box is obviously installed LAMP and the www directory is root directory of Apache server.

Now I want to access to each website through different domains like these:

www.web1.dev

www.web2.dev

But not from the Linux Vargant box but from the Vargant host system - Windows 7.

How can I do it?

You need to set up your or the internets DNS server to point web1.dev to the IP address of the client where your website resides, then using apache.

Apache allows you to do this very easily. You simply need to configure a number of virtual hosts

<VirtualHost www.web1.dev:80>
DocumentRoot "D:/Development/Websites/web1/"
ServerName www.web1.dev


</VirtualHost>

<VirtualHost www.web2.dev:80>
DocumentRoot "D:/Development/Websites/web2/"
ServerName www.web1.dev


</VirtualHost>

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