简体   繁体   English

Bitnami Google Compute Ruby on Rails上的URL路由

[英]URL routing on Bitnami Google Compute Ruby on Rails

I am attempting to deploy the sample rails app: https://github.com/railstutorial/sample_app_rails_4 to the Google Compute Engine using Bitnami. 我正在尝试使用Bitnami将示例Rails应用程序: https : //github.com/railstutorial/sample_app_rails_4部署到Google Compute Engine。 I have followed the wiki instructions to do so from: https://wiki.bitnami.com/Infrastructure_Stacks/BitNami_Ruby_Stack#How_can_I_deploy_my_Rails_application.3f 我已经按照Wiki指示从以下网址进行操作: https : //wiki.bitnami.com/Infrastructure_Stacks/BitNami_Ruby_Stack#How_can_I_deploy_my_Rails_application.3f

But upon attempting to access the url for the site, it still does not direct to the Rails app as you can see here: http://www.1234-ok-go.com (a domain I have purchased) it simply goes to the base Ruby Stack success page. 但是,在尝试访问该站点的URL时,它仍然无法直接定向到Rails应用程序,因为您可以在此处看到: http : //www.1234-ok-go.com (我已购买的域),它只是转到基本的Ruby Stack成功页面。

Even though I have setup the httpd-vhosts.conf to specifically target the Rails App: 即使我已经设置httpd-vhosts.conf专门针对Rails应用程序:

<VirtualHost *:80>
  ServerName 1234-ok-go.com
  DocumentRoot "/opt/bitnami/apps/myapp/htdocs/public"
  Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
  ServerName 1234-ok-go.com
  DocumentRoot "/opt/bitnami/apps/myapp/htdocs/public"
  Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
</VirtualHost>

How can this issue be alleviated and route the URL to my Rails app? 如何缓解此问题并将URL路由到我的Rails应用程序?

Bitnami developer here. Bitnami开发人员在这里。

After you had created your httpd-vhosts.conf (the one you pasted) file under installdir/apps/myapp/conf/ you have to append this line to /installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf installdir/apps/myapp/conf/下创建了httpd-vhosts.conf(粘贴的文件)文件之后,您必须将此行附加到/installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf

Include "/installdir/apps/myapp/conf/httpd-vhosts.conf"

And then create this file: /opt/bitnami/apps/myapp/conf/httpd-app.conf to look something like this: 然后创建此文件: /opt/bitnami/apps/myapp/conf/httpd-app.conf看起来像这样:

<Directory /installdir/apps/myapp/htdocs/public>
    Options +FollowSymLinks
    AllowOverride None
    <IfVersion < 2.3 >
      Order allow,deny
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
      Require all granted
    </IfVersion>
    PassengerEnabled on
    PassengerAppRoot "/installdir/apps/myapp/htdocs"
</Directory>

And finally, restart apache: 最后,重新启动apache:

<installdir>/ctlscript.sh restart apache

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM