Apache 配置多端口 多虚拟主机 局域网访问示例
程序员文章站
2023-11-11 15:17:52
一、在\wamp\bin\apache\apache2.4.4\conf\extra\httpd-vhosts.conf 修改如下 复制代码 代码如下: namevirtu...
一、在\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>
二、\wamp\bin\apache\apache2.4.4\conf\httpd.conf 修改如下:
在该文件中查找“listen”一词修改
listen 80
listen 8080
# virtual hosts
# include conf/extra/httpd-vhosts.conf去掉前面的#,这样就开启了httpd-vhosts虚拟主机文件。这时候重启环境
三、c:\windows\system32\drivers\etc\hosts 修改配置
<pre code_snippet_id="331423" snippet_file_name="blog_20140507_1_9705788"></pre>
<pre></pre>
<pre></pre>
<pre></pre>
复制代码 代码如下:
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>
二、\wamp\bin\apache\apache2.4.4\conf\httpd.conf 修改如下:
在该文件中查找“listen”一词修改
复制代码 代码如下:
listen 80
listen 8080
# virtual hosts
# include conf/extra/httpd-vhosts.conf去掉前面的#,这样就开启了httpd-vhosts虚拟主机文件。这时候重启环境
三、c:\windows\system32\drivers\etc\hosts 修改配置
复制代码 代码如下:
<pre code_snippet_id="331423" snippet_file_name="blog_20140507_1_9705788"></pre>
<pre></pre>
<pre></pre>
<pre></pre>