在Apache2.2和PHP 5.3上设置虚拟主机

我想在Apache 2.2上设置我的虚拟主机

所以,我可以使用我的IP地址和端口号访问我的网站。

一个网站的http://192.168.101.111:429 ,其他网站的http://192.168.101.111:420等等。

我在Windows 7中的机器操作系统。

我已经在我的httpd.conf文件中试过了。

Listen 192.168.101.83:82 #chaffoteaux <Directory "Path to project folder"> AllowOverride All </Directory> <VirtualHost 192.168.101.83:82> ServerAdmin [email protected] DirectoryIndex index.html index.htm index.php index.html.var DocumentRoot "Path to project folder" #ServerName dummy-host.example.com ErrorLog logs/Zara.log #ErrorLog logs/dummy-host.example.com-error_log #CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> 

你可以请build议我的configuration中缺less任何东西。

提前致谢

阿维纳什

你需要指定你希望apache监听的不同端口。

你也需要这个

 NameVirtualHost 

为您要使用的每个IP:端口组合指定指令。

然后设置您的VirtualHost定义。

看看这些例子的更多信息。

编辑

把你的<Directory>块放在你的<VirtualHost>块中

添加行

 Order allow,deny Allow from all 

在您的目录块内

如果你想要的话,你可以在httpd.conf中全局地更改这些设置,而不必在每个虚拟主机的基础上指定它们。