问题描述
我正在尝试在Apache,Passenger 3.0.0和Rails 3.0.3下部署一个简单的Rails应用程序。我遇到各种奇怪的错误。
I'm trying to get a bare bones Rails app deployed under Apache, Passenger 3.0.0 and Rails 3.0.3. I'm getting all kinds of weird errors. mostly revolving around what I think is related to bundler or RAILS_ENV.
关于该应用程序的唯一非默认的事情是开发和应用程序。测试环境使用SQLite3,生产环境使用MySQL。
Only non-default thing about the app is that development & test environments use SQLite3 and production uses MySQL.
从网络浏览器访问应用程序时,乘客抛出有关宝石(sqlite3)的错误,这些宝石特别(在Gemfile中和在database.yml中)声明为不属于生产环境。
When hitting app from web browser Passenger is throwing errors regarding gems (sqlite3) that are specifically (in the Gemfile AND in the database.yml) declared as NOT part of the production environment.
我如何知道服务器尝试以哪个用户身份运行我的Rails应用程序?我想确保为该用户正确设置RAILS_ENV,因为出于某些原因,我认为Passenger试图在开发模式下运行此应用。
How can I tell what user the server is trying to run my Rails app as? I would like to make sure the RAILS_ENV is set correctly for that user as I think Passenger is trying to run this app in development mode for some reason.
编辑:添加了 ps aux的结果| grep httpd
myserver:current elvis$ ps aux | grep httpd
elvis 4424 0.4 0.0 66152 192 s000 S+ 11:03AM 0:00.00 grep httpd
_www 1950 0.0 0.2 93024 2544 ?? S 11:40PM 0:01.23 /usr/sbin/httpd -D FOREGROUND
root 1918 0.0 1.0 93024 10244 ?? Ss 11:39PM 0:02.75 /usr/sbin/httpd -D FOREGROUND
_www 4084 0.0 0.2 93024 2536 ?? S 9:41AM 0:00.15 /usr/sbin/httpd -D FOREGROUND
和 ls -l ...
myserver:current elvis$ ls -l config
total 48
-rw-rw-r-- 1 aaron admin 1923 Nov 19 21:40 application.rb
-rw-rw-r-- 1 aaron admin 326 Nov 19 21:40 boot.rb
-rw-rw-r-- 1 aaron admin 741 Nov 19 21:40 database.yml
-rw-rw-r-- 1 aaron admin 1257 Nov 19 21:40 deploy.rb
-rw-rw-r-- 1 aaron admin 149 Nov 19 21:40 environment.rb
drwxrwxr-x 5 aaron admin 170 Nov 19 21:40 environments
drwxrwxr-x 7 aaron admin 238 Nov 19 21:40 initializers
drwxrwxr-x 3 aaron admin 102 Nov 19 21:40 locales
-rw-rw-r-- 1 aaron admin 1808 Nov 19 21:40 routes.rb
推荐答案
默认情况下,旅客将以拥有<$ c $的用户身份运行您的应用c> config / environment.rb 或 config.ru
文件,请参见
By default, passenger will run your app as the user who owns the config/environment.rb
or config.ru
file, see http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching
Passenger默认情况下将在生产
环境中运行,除非您通过 RailsEnv
,请参见
Passenger will run in the production
environment by default unless you tell it otherwise with the RailsEnv
, see http://www.modrails.com/documentation/Users%20guide%20Apache.html#rails_env
这篇关于哪个用户正在运行我的Rails应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!