我如何用Passenger和Apache设置RAILS

编程入门 行业动态 更新时间:2024-10-24 18:21:34
本文介绍了我如何用Passenger和Apache设置RAILS_ENV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

今天我到处都在寻找为旅客正确设置RAILS_ENV的方法.现在该站点位于我的服务器上,因此我想使用测试环境,但是我不希望它成为生产环境,因为我遇到了数据库问题.

I've been everywhere today looking for the way to properly set my RAILS_ENV for Passenger. I want to use the test environment now that the site is on my server, but I don't want it to be production because I'm having database issues.

我被定向到文档的这一部分,但对我来说没有任何意义.我在该站点的Apache .conf文件中有 PassengerAppEnv RAILS_ENV ='test',并且-如预期的那样-无效.

I've been directed to this part of the documentation, but it didn't make any sense to me. I had PassengerAppEnv RAILS_ENV = 'test' in my Apache .conf file for the site and -- as expected -- that didn't' work.

我还在我的Rails站点的 config/environment.rb 中设置了 RAILS_ENV ='test',但这也不起作用.

I've also set RAILS_ENV = 'test' in config/environment.rb of my Rails site, but that didn't work either.

谢谢!

推荐答案

您已经接近,但不太正确.设置方法如下:

You're close, but not quite correct. Here is how you set it:

<Directory /path/to/app/public> Allow from all Options -Multiviews # ^ for Apache 2.4+ Require all granted RailsEnv development # < place desired environment here </Directory>

基本上,Passenger将在配置文件中看到该行,然后为您设置.它使用更多的Apache样式语法:

Basically Passenger will see the line in the configuration file and then set it for you. It uses the more Apache style syntax of:

Name [space] <value>

因此,您根本不需要所有的引号或任何Ruby样式的语法.

So you don't need all the quotes or any Ruby style syntax at all.

更多推荐

我如何用Passenger和Apache设置RAILS

本文发布于:2023-10-28 13:27:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1536765.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何用   Passenger   RAILS   Apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!