问题描述
任何人都可以指导我学习如何使用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 和 http://192.168.1.102:8089 .但是,当我输入第二个URL时,它会将我定向到在端口80上运行的网站.
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 [email protected]
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 [email protected]
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上设置虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!