There may be only one IP outlet, but there are multiple projects, then you need to set up a virtual host based on the port number.
Step 1:
Check whether the httpd-vhosts.conf is enabled
Apache/CONF/httpd. conf file
# Virtual hostsInclude conf/extra/httpd-vhosts.conf
If it is not enabled, it must be in httpd. CONF file; if enabled, you can set in Apache/CONF/extra/httpd-vhosts.conf file, of course, you can also httpd. the configuration in the conf file is also valid.
Step 2:
Httpd. in the conf file, DocumentRoot must be configured as the parent directory of the project of the VM, where DocumentRoot has the highest limit, the DocumentRoot directory level set in the VM can only be equal to or lower than the DocumentRoot directory here.
# symbolic links and aliases may be used to point to other locations.#DocumentRoot "D:\htdocs"<Directory "D:\htdocs">
Step 3:
Add a multi-port listener to the httpd. conf file.
## Listen: Allows you to bind Apache to specific IP addresses and/or# ports, instead of the default. See also the <VirtualHost># directive.## Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses.##Listen 12.34.56.78:80Listen 80Listen 81Listen 82
Step 4:
Follow the rules in step 1 to add the VM configuration.
<VirtualHost *:80> DocumentRoot "D:\htdocs\project1\www" ServerName 127.0.0.1:80 <Directory "D:\htdocs\project1\www"> Options Indexes FollowSymLinks Multiviews AllowOverride All Order Allow,Deny Allow from all </Directory></VirtualHost>
<VirtualHost *:81> DocumentRoot "D:\htdocs\project2" ServerName 127.0.0.1:81 <Directory "D:\htdocs\project2"> Options Indexes FollowSymLinks Multiviews AllowOverride All Order Allow,Deny Allow from all </Directory></VirtualHost>
Note:
The configuration of port 80 must be overwritten in the VM configuration. Otherwise, the DocumentRoot directory configured in httpd. conf will be used, and the project's parent directory will be exposed.