服务器之家:专注于VPS、云服务器配置技术及软件下载分享
分类导航

云服务器|WEB服务器|FTP服务器|邮件服务器|虚拟主机|服务器安全|DNS服务器|服务器知识|Nginx|IIS|Tomcat|

服务器之家 - 服务器技术 - 服务器知识 - Apache 配置多端口 多虚拟主机 局域网访问示例

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

2021-10-15 15:28服务器技术网 服务器知识

这篇文章主要介绍了Apache如何配置多端口 多虚拟主机 局域网访问,需要的朋友可以参考下

一、在wampinpacheApache2.4.4confextrahttpd-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>


二、wampinpacheApache2.4.4confhttpd.conf 修改如下:

在该文件中查找“Listen”一词修改

复制代码 代码如下:


Listen 80
Listen 8080


# Virtual hosts
# Include conf/extra/httpd-vhosts.conf去掉前面的#,这样就开启了httpd-vhosts虚拟主机文件。这时候重启环境

三、C:WindowsSystem32driversetchosts 修改配置

复制代码 代码如下:


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

延伸 · 阅读

精彩推荐