帮助中心 >  技术知识库 >  网站相关 >  建站知识 >  apache 多端口配置及网站指向非apache默认的网站文件夹设置方法

apache 多端口配置及网站指向非apache默认的网站文件夹设置方法

2015-10-26 10:39:22 7116

  • 首先我们需要开启 Virtual hosts,进入Apache2.2conf目录下的httpd.conf文件,用搜索查找 Virtual hosts,并且将

Include conf/extra/httpd-vhosts.conf前个“#"删除保存。

  • 在Apache的配置文件httpd-vhosts.conf下进行操作,位置在Apache安装目录下的Apache2.2confextra文件中。如图

  • 用文本文档打开httpd-vhosts.conf文件

添加如下红色部分,默认情况下只有80端口。下面代码中每个颜色对应的响应对口的设置和目录。
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesnt need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://www.landui.com/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option -S to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#

NameVirtualHost *:80
NameVirtualHost *:81
NameVirtualHost *:82
NameVirtualHost *:83
NameVirtualHost *:84
NameVirtualHost *:85
NameVirtualHost *:86

NameVirtualHost *:88
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:81>
         ServerAdmin jsw7001@hotmail.com
         DocumentRoot D:/AppServ/www/www-nongye
         ServerName www.landui.com
         ErrorLog D:/AppServ/www/www-nongye/errornongye.log
         CustomLog logs/dummy-host2.appservnetwork.com-access_log common
</VirtualHost>
<VirtualHost *:82>
    <Directory "D:/AppServ/www-chinaec" >
        Options FollowSymLinks
        #Deny from all
        Allow from all
    </Directory>
         ServerAdmin jsw7001@hotmail.com
         DocumentRoot D:/AppServ/www-chinaec
         ServerName www.landui.com
     DirectoryIndex index.php index.html
         ErrorLog D:/AppServ/www-chinaec/errornongjiale.log
         CustomLog logs/dummy-host2.appservnetwork.com-access_log common
</VirtualHost>
<VirtualHost *:83>
         ServerAdmin jsw7001@hotmail.com
         DocumentRoot D:/AppServ/www/www-05110
         ServerName www.landui.com
         ErrorLog D:/AppServ/www/www-05110/errornong05110.log
         CustomLog logs/dummy-host2.appservnetwork.com-access_log common
</VirtualHost>
<VirtualHost *:84>
         ServerAdmin jsw7001@hotmail.com
         DocumentRoot D:/AppServ/www/wordpress
         ServerName www.landui.com
         ErrorLog D:/AppServ/www/wordpress/errornongwordpress.log
         CustomLog logs/dummy-host2.appservnetwork.com-access_log common
</VirtualHost>
<VirtualHost *:85>
         ServerAdmin jsw7001@hotmail.com
         DocumentRoot D:/AppServ/www/magento
         ServerName www.landui.com
         ErrorLog D:/AppServ/www/magento/errormagento.log
         CustomLog logs/dummy-host2.appservnetwork.com-access_log common
</VirtualHost>
<VirtualHost *:86>
         ServerAdmin jsw7001@hotmail.com
         DocumentRoot D:/AppServ/www/magento1322
         ServerName www.landui.com
         ErrorLog D:/AppServ/www/magento1322/errormagento1322.log
         CustomLog logs/dummy-host2.appservnetwork.com-access_log common
</VirtualHost>
<VirtualHost *:88>
         ServerAdmin jsw7001@hotmail.com
         DocumentRoot D:/AppServ/www/www-nongjiale
         ServerName www.landui.com
         ErrorLog D:/AppServ/www/www-nongjiale/errornongjiale.log
         CustomLog logs/dummy-host2.appservnetwork.com-access_log common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.x
    DocumentRoot "C:/Apache2.2/docs/dummy-host2.x"
    ServerName dummy-host2.x
    ErrorLog "logs/dummy-host2.x-error.log"
    CustomLog "logs/dummy-host2.x-access.log" common
</VirtualHost>


这样保存后,就完成我们不同端口的建设。





提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: