我们有一个Sinatra应用程序通过乘客在域根中运行,例如http://rootdomain.com/
我们有一些PHP页面,我们想在一个子目录中提供服务,如下所示:http://rootdomain.com/example
Sinatra应用程序位于通过mina/git部署到的文件夹/var/webapps/homepage
中。
理想情况下,我们将PHP脚本放在/var/www/example
中,并由Apache提供这些页面。
我尝试执行此操作的方法是通过 Apache 别名:
httpd.conf
Alias /example/ /var/www/example
Alias /example /var/www/example
但是,除 http://rootdomain.com/example/index.php
以外的任何内容都会返回 404(例如:http://rootdomain.com/example 或 http://rootdomain.com/example/'
我的httpd.conf有一个这样的指令:
<Directory /var/www/example>
Options All
AllowOverride All
order allow,deny
allow from all
DirectoryIndex index.html index.php
</Directory>
在这里找到了一个解决方案:
https://serverfault.com/questions/530958/apache2-with-passenger-and-subdirectory-with-file-listing
这是令人难以置信的,简单地禁用指定文件夹的乘客,因此在上面的情况下,它将是:
<Location /var/www/example/>
PassengerEnabled off
</Location>
在<virtualhost>...</virtualhost>
块内。