2017-07-07 20 views
2

我有一个在myapp.site.com下运行的运行轨应用程序。此应用在端口9000内运行,我们使用的是Apache的ProxyPass如何在Apache上同时设置<Directory>和ProxyPass?

所有的页面目前都是由rails服务的,但现在我已经有了一个JS应用程序,我想在/account路线和子路线上提供服务。这个应用程序的文件在/var/www/my-vue-app/dist

我该如何使用apache设置?我试过设置了两个<VirtualHost>;对于所有不是/account,以及一堆其他hacky解决方案都没有运气的例外

任何提示?

回答

0

找到了如何配置apache,基本上我只需要排除ProxyPass上的特定路由,并按预期方式运行apache。

<VirtualHost *:80> 
    DocumentRoot /var/www/myapp/dist 

    ProxyPreserveHost On 
    ProxyPass /account ! 
    ProxyPass/http://localhost:9000/ 
    ProxyPassReverse/http://localhost:9000/ 

    Alias /account /var/www/myapp/dist 
    <Directory /var/www/myapp/dist> 
      DirectoryIndex index.html 
      AllowOverride all 
      Order allow,deny 
      Allow from all 

      RewriteEngine On 
      RewriteBase /account 
      RewriteRule ^index\.html$ - [L] 
      RewriteCond %{REQUEST_FILENAME} !-f 
      RewriteCond %{REQUEST_FILENAME} !-d 
      RewriteRule ^(.*)$ /account/index.html [L] 
    </Directory> 
</VirtualHost> 
相关问题