【问题标题】:Debian & apache deploying multiple applications [closed]Debian和apache部署多个应用程序[关闭]
【发布时间】:2013-05-20 06:44:02
【问题描述】:

我有一个小问题。
我有两个名为 appAappB 的应用程序是使用 PHP 创建的。我想同时将它们部署在apache2 服务器上,以便能够测试它们之间的集成(有些东西不起作用)。到目前为止,我每次都在

/etc/apache2/sites-enabled/sites.conf

中编辑 apache VirtualHost 配置

我试图通过创建第二个*.conf 文件来编辑我的Hosts,如下所示:

<VirtualHost localhost:80>
        ServerAdmin webmaster@example.net
        ServerName appA
        ServerAlias appA
        DocumentRoot /var/www/appA
</VirtualHost>

进入

<VirtualHost localhost/appA:80>
        ServerAdmin webmaster@example.net
        ServerName appA
        ServerAlias appA
        DocumentRoot /var/www/appA
</VirtualHost>

但我只是得到 apache 重启错误:

[error] (EAI 2)Name or service not known: Could not resolve host name

主要的是现在我可以在地址上获取我的 appA:localhost 如果我的 sites-ebabled conf 设置为 DocummentRootappA 并且使用 BI 必须更改 VirtuanlHost 的配置

目标是在localhost/appA 下拥有appA,在localhost/appB 下拥有appB

我确实意识到我必须编辑 DNShost 文件,但任何人都可以帮助我,因为我没有想法..

【问题讨论】:

  • 虚拟主机只是主机名和可选端口,不包括目录。

标签: php apache networking debian


【解决方案1】:

您只需要一个 VirtualHost 和许多目录:

<VirtualHost localhost:80>
        ServerAdmin webmaster@example.net
        ServerName myServer
        ServerAlias myServer
        DocumentRoot /var/www
</VirtualHost>

 Alias /appA "/var/www/appA"
 <Directory /var/www/appA>
   Options Indexes Includes FollowSymLinks MultiViews
   AllowOverride AuthConfig FileInfo
   Order allow,deny
   Allow from all
 </Directory>

 Alias /appB "/var/www/appB"
 <Directory /var/www/appB>
   Options Indexes Includes FollowSymLinks MultiViews
   AllowOverride AuthConfig FileInfo
   Order allow,deny
   Allow from all
 </Directory>

然后您只需使用它们访问它们

http://localhost/appA

http://localhost/appB

因为您的 VirtualHost 位于端口 80。

【讨论】:

  • 我得到了 HTTP 500:Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
  • 看看apache日志,那里一定有更多关于这个错误的信息。这个 conf 刚刚从我的工作主机复制过来。
  • 好的,经过一些修改,它可以完美运行。谢谢!
猜你喜欢
  • 1970-01-01
  • 2012-07-15
  • 1970-01-01
  • 1970-01-01
  • 2012-05-02
  • 2013-11-15
  • 2010-09-07
  • 2011-08-10
  • 1970-01-01
相关资源
最近更新 更多