Phusion Passenger users guideメモ - うんたらかんたらRuby - Rubyistの続き
ログレベル
5.2. PassengerLogLevel
0: Show only errors and warnings.(デフォルト)
1: Show the most important debugging information. This might be useful for system administrators who are trying to figure out the cause of a problem.
2: Show more debugging information. This is typically only useful for developers.
3: Show even more debugging information.
実行ユーザ
5.6. PassengerUserSwitching
Whether to enable user switching support.
This option may only occur once, in the global server configuration. The default value is on.
5.7. PassengerDefaultUser
Passenger enables user switching support by default. This configuration option allows one to specify which user Rails/Rack applications must run as, if user switching fails or is disabled.
This option may only occur once, in the global server configuration. The default value is nobody.
8.1. User switching (security)
A Rails application is started as the owner of the file config/environment.rb.
This behavior is the default, and you don’t need to configure anything. But there are things that you should keep in mind:・The owner of environment.rb must have read access to the Rails application’s folder, and read/write access to the Rails application’s logs folder.
(略)
6.3.6. The Rails application reports that it’s unable to start because of a permission error
Please check whether your Rails application’s folder has the correct permissions. By default, Rails applications are started as the owner of the file config/environment.rb, except if the file is owned by root. If the file is owned by root, then the Rails application will be started as nobody (or as the user specify by RailsDefaultUser, if that’s specified).
要は
PassengerUserSwitching がdefaultでONになっているので
config/environment.rbのownerでRailアプリが実行される。
ユーザを指定して実行したいのであれば、config/environment.rbのownerを変更するか
PassengerUserSwitching をOFFにした上でRailsDefaultUserを定義する。
ちょっとやってみた
default(environment.rbのowner rochefort)
$ ps aux | grep Rails rochefort 41944 0.0 1.0 646644 41560 ?? S 4:31PM 0:01.32 Rails: /webapp/rails/redmine
default(environment.rbのowner hoge)
$ ps aux | grep Rails hoge 51242 0.0 0.6 645120 26112 ?? S 5:07PM 0:00.17 Rails: /webapp/rails/redmine
PassengerUserSwitching OFF
$ ps aux | grep Rails nobody 49242 0.0 0.6 645120 26344 ?? S 5:00PM 0:00.16 Rails: /webapp/rails/redmine
defaultのnobodyで上がる。
PassengerUserSwitching OFF かつ RailsDefaultUser hoge
$ ps aux | grep Rails hoge 50130 0.0 0.6 645120 26140 ?? S 5:03PM 0:00.16 Rails: /webapp/rails/redmine
ちゃんと見てなかったけど、Passenger ApplicationSpawnerも同一ユーザで実行している模様。
サブURIの静的コンテンツ
8.9. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments
おおお、static URI じゃなく relative URI って書いてるやん。。。
最初にちゃんと読むべきだったな。
passengerのcss - うんたらかんたらRuby - Rubyist
後でやる
チューニング
5.12.1. PassengerMaxPoolSize
5.12.3. PassengerPoolIdleTime
5.12.4. PassengerMaxRequests
Capistrano.
8.3. Capistrano recipe