在一台服务器上配置多个Kohana应用程序

时间:2014-02-20 17:36:00

标签: php apache wamp lamp kohana-3

目前我在Windows机器上使用wamp并且已经为一个站点运行kohana。我想部署另一个完全独立的网站并使用不同的kohana副本。为此,我添加了文件结构并部署了kohana,如下所示

+wamp
++www
+++site1
++++kohana
+++site2
++++kohana

目前我的apache httpd.conf监听器如下

Listen 0.0.0.0:80

我在Windows目录中的主机文件设置为

127.0.0.1       localhost
127.0.0.1 site1.localhost
127.0.0.1 site2.localhost

目前,当我访问localhost时,它将转到site1.localhost。或者,如果我转到site1.localhost,它将转到站点1.如果我转到site2.localhost,应用程序将重定向到site1.localhost

我对LAMP很新,所以这可能是一个非常基本的问题,我为此道歉。

1 个答案:

答案 0 :(得分:0)

创建虚拟主机就是答案

<VirtualHost site1.localhost>
    ServerAdmin webmaster@site1
    ServerName site1

    DocumentRoot "C:/wamp/www/site1"

    <Directory "C:/wamp/www/site1">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>


    ErrorLog "logs/site1-error.log"
    CustomLog "logs/site1-access.log" common
</VirtualHost>

<VirtualHost site2.localhost>
    ServerAdmin webmaster@site2
    ServerName site2

    DocumentRoot "C:/wamp/www/site2"

    <Directory "C:/wamp/www/site2">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>


    ErrorLog "logs/site2-error.log"
    CustomLog "logs/site2-access.log" common
</VirtualHost>