This article takes Apache as an example to describe how to configure the virtual home directory. What does he do, configure him, access the marked domain name, you can access a specific directory level, such as direct access to a folder under/www. Steps: 1. Open the related configuration; 2. Configure the Vhost configuration file, copy 3. Restart Apache
1. Sudo vim/etc/apache2/httpd.conf to open the PHP module, remove the preceding semicolon 2. Open the import vhost file.
sudo vi/etc/apache2/extra/httpd-vhosts.conf
Enter the following code:
<virtualhost *:80>
ServerName www.mall.com [here needs to be changed to your]
documentroot "/library/webserver/ Documents/mall "[here needs to be modified to your]
<directory"/library/webserver/documents/mall ">[here needs to be modified to your
Options FollowSymLinks includesnoexec Indexes
directoryindex index.html
index.htm-index.php All Order Deny,allow
Allow to
Require all granted
</Directory>
</VirtualHost>
<virtualhost *:80>
ServerName localhost
documentroot "/library/webserver/documents" [here needs to be modified to your]
<directory "/library/webserver/documents/mall" >[here need to be modified to your]
Options followsymlinks includesnoexec Indexes
directoryindex index.html index.htm index.php
allowoverride All order
Deny,allow
Allow out of
Require all granted
</Directory>
</ Virtualhost>
3. Restart Apache
sudo apachectl restart