apache virtual machine configuration steps and modify the method to access the port of virtual machine port mapping

  • 2020-05-07 20:48:32
  • OfStack

1. Add a service port
In the file Apache\conf\ httpd.conf,
1. Find Listen 80   and add 1 line   Listen 8001 below it (the port can be reset by itself).
2, find


#LoadModule rewrite_module modules/mod_rewrite.so 

Module, remove the # sign.

3, because the virtual host, so find


#Include conf/extra/httpd-vhosts.conf

Remove the # in front.

2. Add service virtual configuration

In the Apache\conf\extra\ httpd-vhosts.conf file, modify the corresponding configuration:


NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@d.localhost
    DocumentRoot "D:/wamp/www/Lee"
    ServerName www.lee.com
    ServerAlias www.dummy-host.localhost
    ErrorLog "logs/dummy-host.localhost-error.log"
    CustomLog "logs/dummy-host.localhost-access.log" common
</VirtualHost>
NameVirtualHost *:8001
<VirtualHost *:8001>
    ServerAdmin webmaster@d.localhost
    DocumentRoot "D:/wamp/www/LiMei"
    ServerName www.limei.com
    ErrorLog "logs/dummy-host2.localhost-error.log"
    CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>


3. Open the C: \ WINDOWS \ system32 \ drivers \ etc \ hosts

Enter the following:


127.0.0.1       www.ofstack.com
127.0.0.1       bbs.ofstack.com

Save the file.


Related articles: