Apache configuration multi port multi virtual host LAN access example


1. In \wamp\bin\apache\ Apache2.4.4 \conf\extra\ httpd-vhosts.conf


NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "E:/website/pxsj"
ServerName host7.com
ServerAlias 192.168.1.116
<Directory "E:/website/pxsj">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

NameVirtualHost *:8080

<VirtualHost *:8080>
DocumentRoot "E:/website/whsj"
ServerName host10.com:8080
ServerAlias 192.168.1.116:8080
<Directory "E:/website/whsj">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

2. \wamp\bin\apache\ Apache2.4.4 \conf\ httpd.conf

Look for the “Listen” 1 word modification in this file


Listen 80
Listen 8080

# Virtual hosts # Include conf/extra/ httpd-vhosts.conf remove the preceding # to open the httpd-vhosts virtual host file. At this point, restart the environment

3. C:\Windows\System32\drivers\etc\hosts modified configuration


<pre code_snippet_id="331423" snippet_file_name="blog_20140507_1_9705788"></pre>
<pre></pre>
<pre></pre>
<pre></pre>