如何在Apache 2.2上设置虚拟主机 [英] How to set up virtual hosts on Apache 2.2

查看:71
本文介绍了如何在Apache 2.2上设置虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以指导我学习如何使用Apache 2.2设置虚拟主机的优秀教程吗?这是我的情况:

Can anyone direct me to a good tutorial on how to set up virtual hosts using Apache 2.2? Here's my situation:

我的笔记本电脑上运行的是Apache,我想要两个网站-一个在端口80上,一个在端口8089上.我想通过输入计算机的IP地址从网络上的另一台计算机访问每个站点,例如 http://192.168.1.102

I have Apache running on my laptop and I want two websites-- one on port 80 and one on port 8089. I want to access each site from the other computer on my network by entering the computer's IP address, such as http://192.168.1.102 and http://192.168.1.102:8089. Yet when I enter the second url, it directs me to the website running on port 80.

在此先感谢您的帮助.

推荐答案

仅定义了2个虚拟主机,如下所示,但是具有不同的DocumentRoots:

Just have 2 virtual hosts defined like this, but with differeing DocumentRoots:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.somecompany.com
    DocumentRoot "/docs/dummy-host.somecompany.com"
    ServerName dummy-host.somecompany.com
    ServerAlias www.dummy-host.somecompany.com
    ErrorLog "logs/dummy-host.somecompany.com-error.log"
    CustomLog "logs/dummy-host.somecompany.com-access.log" common
</VirtualHost>

<VirtualHost *:8089>
    ServerAdmin webmaster@dummy-host.somecompany.com
    DocumentRoot "/docs/dummy-host.somecompany.com"
    ServerName dummy-host.somecompany.com
    ServerAlias www.dummy-host.somecompany.com
    ErrorLog "logs/dummy-host.somecompany.com-error.log"
    CustomLog "logs/dummy-host.somecompany.com-access.log" common
</VirtualHost>

这篇关于如何在Apache 2.2上设置虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆