我从http://httpd.apache.org/download.cgi下载了 apache2.2.22 src并进行了安装。安装工作正常。但是当我尝试添加虚拟主机时,问题就出现了。我添加了 2 个虚拟主机 1. localhost 2. someother.localhost 两者都指向不同的文档根目录,但解析到第一个虚拟主机的文档根目录。
这是我的虚拟主机文件,
名称虚拟主机 *:80
<VirtualHost *:80> ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "/webserver/htdocs" ServerName localhost ErrorLog "logs/localhost-error_log" CustomLog "logs/localhost-access_log" common </VirtualHost> <Directory /home/sourabhn/somepath> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <VirtualHost *:80> ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "/home/sourabhn/somepath" ServerName someother.localhost ErrorLog "logs/someother-localhost-error_log" CustomLog "logs/someother-localhost-access_log" common </VirtualHost>
我在 hosts 文件中做了相应的条目。我正在运行 Ubuntu 11.10 机器。请回复您的宝贵建议