当前位置: 移动技术网 > 网络运营>服务器>Linux > Apache 配置多端口 多虚拟主机 局域网访问示例

Apache 配置多端口 多虚拟主机 局域网访问示例

2019年05月02日  | 移动技术网网络运营  | 我要评论
一、在\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>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网