On a virtual machine on Apache (Apache) (4) based on the domain name visit

When the server can not be assigned to a separate IP address for each site,

Apache can try to make the service automatically identify the origin host name or domain name and then jump to the specified site.

First configure the network card and the hosts file Ip address

Enter the command: vim / etc / hosts (each line can only write one, the format is IP address + space + host name (domain name))

 

 

Once you've configured file

Then create three data directory website

Enter the command: mkdir -p / home / wwwroot / {www, eee, rrr}

Files are written in different home page in the Site Directory

echo "WWW.bujiami.com"  >/home/wwwroot/www/index.html

echo "EEE.bujiami.com"  >/home/wwwroot/eee/index.html

echo "RRR.bujiami.com"  >/home/wwwroot/rrr/index.html

 

 Next we want to httpd.conf configuration file (you can also back up what the first cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak)

Enter the command: find vi /etc/httpd/conf/httpd.conf after entering the position to be modified, if not find a location can build their own (the same steps to write several other home ip) (here we omit the firewall configuration, with a good default)

 

 After configuring the service httpd restart

 

 

Search completed

 

 

 

 

  If you want other computers can also access this page, you need other hosts file so too is set (must have httpd service)

 

 

Guess you like

Origin www.cnblogs.com/escwq/p/11783451.html