设置具有多个虚拟主机的apache

时间:2013-03-14 19:06:50

标签: apache mod-rewrite virtualhost virtual-hosts

我遇到了让虚拟主机按照我的意愿工作的问题。我一直在寻找最后几个小时,但感觉我比以前更迷失。

所以基本上我想要以下设置:

  1. http://test.localhost => d:\ XAMPP \ htdocs中\测试\站点
  2. http://test.localhost/call => d:\ XAMPP \ htdocs中\测试\背面\ call.pl
  3. 并且可能添加其他内容,例如/其他任何指向其他.pl脚本
  4. 有人能给我一个提示吗?我一定错过了一些明显的东西......

2 个答案:

答案 0 :(得分:1)

对于localhost子域,您必须将该子域添加到/ etc / hosts

127.0.0.1       localhost       test.localhost

答案 1 :(得分:0)

您是否尝试过编辑apache conf文件?

像这样的东西

# vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
NameVirtualHost *:80

<VirtualHost *:80>
 ServerAdmin ramesh@thegeekstuff.com
 DocumentRoot "/usr/local/apache2/docs/thegeekstuff"
 ServerName thegeekstuff.com
 ServerAlias www.thegeekstuff.com
 ErrorLog "logs/thegeekstuff/error_log"
 CustomLog "logs/thegeekstuff/access_log" common
</VirtualHost>

<VirtualHost *:80>
 ServerAdmin ramesh@top5freeware.com
 DocumentRoot "/usr/local/apache2/docs/top5freeware"
 ServerName top5freeware.com
 ServerAlias www.top5freeware.com
 ErrorLog "logs/top5freeware/error_log"
 CustomLog "logs/top5freeware/access_log" common
</VirtualHost>