重定向到 Rails 3 中的子域
我刚刚使用 apache2 和乘客在 Amazon EC2 上设置了 Rails 3。
一切都很好,但是当我在里面创建我的第一个项目时 /var/www/html/ror/public/ 该项目未显示。我尝试了 mydomain.com/example 这是我的项目的名称,它为我提供了我之前生成的 Rails 项目的索引。当我说索引时,我指的是所有文件夹的列表,而不从视图中渲染任何 html。我想我的问题是:如何将用户重定向到 mydomain.com/example/app/views/example/index.html.erb
我尝试使用 httpd.conf,但似乎没有任何结果。
谢谢
I just set up my rails 3 on Amazon EC2 with apache2 and passenger.
Everything is working great but when I created my first project inside
/var/www/html/ror/public/ the project does not show up. I tried mydomain.com/example which is the name of my project and it gives me an index of my rails project that I generated earlier. When I say index I mean a list of all the folders without rendering any html from the views. I guess my question is: how do I redirect the user to mydomain.com/example/app/views/example/index.html.erb
I tried playing around with httpd.conf and but nothing seems to work out.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您在部署站点时遇到问题。按照此操作 -
创建虚拟主机
$ sudo nano /etc/apache2/sites-available/app-name
将虚拟主机的内容改为
启用新站点
$ sudo a2ensite demo-app
重新启动 Apache
$ sudo /etc/init.d/apache2 restart
确保提及正确的文档根目录。
更多详情 - https://docs.google.com/document/ d/1Cw-oiE4AYrnbo_b7o593npTPaW8hRhRZERJ_ZETdrB8/edit?hl=en
You are facing problems in deploying the site. Follow this -
Create a virtual host
$ sudo nano /etc/apache2/sites-available/app-name
Change the contents of the virtual host to
Enable the new site
$ sudo a2ensite demo-app
Restart Apache
$ sudo /etc/init.d/apache2 restart
Make sure you mention the correct document root.
More details - https://docs.google.com/document/d/1Cw-oiE4AYrnbo_b7o593npTPaW8hRhRZERJ_ZETdrB8/edit?hl=en
您需要将
RailsBaseURI /ror/public
添加到您的 apache 配置中。或者,符号链接:(
不应将 Rails 应用程序源放入您的 apache 文档树中)
,然后
RailsBaseURI /ror
您的应用程序将位于 example.com/ror
You need to add
RailsBaseURI /ror/public
to your apache config.Or, symlink:
(shouldn't put Rails app sources in your apache document tree)
and then
RailsBaseURI /ror
Your app will be at example.com/ror