apache 怎么配置多个端口阿!

nike_ljq 2002-07-31 03:29:29
IIS中,可以很容易的建立多个,虚拟的站点
192.168.100.192:81
192.168.100.192:80
等等
apache 中怎么办啊?
...全文
574 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
skywatcher 2002-08-02
  • 打赏
  • 举报
回复
首先你要找到你的apache上的配置文件httpd.conf,用记事本打开,
找到Listen <你的ip>:80
或者Listen:80
添加或更改为你要添加的端口(不能有冲突)如下面的例子:
Listen 80
Listen 81
Listen 82
再建立虚拟主机,你看看我的机器上的:

NameVirtualHost localhost:80
NameVirtualHost localhost:81
NameVirtualHost localhost:82
<VirtualHost localhost:80>
DocumentRoot f:\skywatcher\web\
ServerName localhost:80
</VirtualHost>
<VirtualHost localhost:81>
ServerAdmin ustbck001@china.com
DocumentRoot f:\skywatcher\web1\
ServerName locahost:81
</VirtualHost>
<VirtualHost localhost:82
DocumentRoot f:\skywatcher\web\phpmyadmin
ServerName localhost:82
</VirtualHost>
LeeMaRS 2002-08-01
  • 打赏
  • 举报
回复
在httpd.conf中用<VirtualHost>设置虚拟主机:

### Section 3: Virtual Hosts
#
# VirtualHost: 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 doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/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 *

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

并在前面Listen中加入新增的要监听的端口

24,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧