我需要将我的 Rails 应用程序部署到已经在其根目录服务 PHP 站点的服务器。我无法触及现有网站,我必须将我的应用程序部署在子 url 或子域,即xx.xx.xx.xx/rails
或rails.xx.xx.xx.xx
.
我通常用来部署我的应用程序的 Apache 配置:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/RubyStack-3.2.5-0/projects/app_name/public"
<Directory "C:/RubyStack-3.2.5-0/projects/app_name/public">
Allow from all
Options -MultiViews
</Directory>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://app_balancers%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://app_balancers>
BalancerMember http://localhost:3001/
BalancerMember http://localhost:3002/
</Proxy>
# Support for far-futures expires header
<LocationMatch "^/assets/.*$">
Header unset ETag
FileETag None
# RFC says only cache for 1 year
ExpiresActive On
ExpiresDefault "access plus 1 year"
</LocationMatch>
</VirtualHost>
如何更改此配置以从子 URL 或子域提供该文件夹?ARedirectMatch
行不通,因为它还会将人们从现有的 PHP 站点中引导出来,对吗?