0

走った後

sudo service apache2 restart

私は持っている

[Thu Dec 04 15:30:37 2014] [warn] module passenger_module is already loaded, skipping
Syntax error on line 274 of /etc/apache2/apache2.conf:
Invalid command 'PassengerDefaultRuby', perhaps misspelled or defined by a module not included in          the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
 failed!

apache.conf の最後に: (この行は、passenger-install-apache2-module の後に取得しました)

LoadModule passenger_module /home/ruslan/.rvm/gems/r$
<IfModule mod_passenger.c>
 PassengerRoot /home/ruslan/.rvm/gems/ruby-2.1.5/gem$
 PassengerDefaultRuby /home/ruslan/.rvm/gems/ruby-2.$
</IfModule>

/etc/apache2/mods-available/passenger.conf :

<VirtualHost *:80>
    ServerName www.rackexample.com
    DocumentRoot /home/ruslan/blog/public
    <Directory /home/ruslan/blog/public>
        Allow from all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
    </Directory>
</VirtualHost>

/etc/apache2/sites-enabled/mysite には同じものがあります:

<VirtualHost *:80>
    ServerName www.rackexample.com
    DocumentRoot /home/ruslan/blog/public
    <Directory /home/ruslan/blog/public>
        Allow from all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
    </Directory>
</VirtualHost>

また、uri を開くと、次のようになります。

内部サーバーエラー

サーバーで内部エラーまたは構成ミスが発生したため、リクエストを完了できませんでした。

サーバー管理者 [アドレスなし] に連絡して、エラーが発生した時刻と、エラーの原因となった可能性のある操作を知らせてください。

このエラーの詳細については、サーバー エラー ログを参照してください。

146.148.7.236 ポート 80 の Apache/2.2.22 (Debian) サーバー

何が問題になる可能性がありますか?(重要な場合は、Google Developers Console で Debian を使用しています)

ここでも同じ問題に気付きましたが、違いが見つかりません。

UPD: apache.conf の末尾にある行を削除しました。

LoadModule passenger_module

そして今、私はこのエラーがあります:

ruslan@olga-blog:~$ sudo service apache2 restart
Syntax error on line 273 of /etc/apache2/apache2.conf:
Invalid command 'PassengerDefaultRuby', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
 failed!

したがって、Apache ログの最後に tail -f -n 100 /var/log/apache2/error.log ( Fir 05 - 今日なので、最新のログ) が表示されます。

[Fri Dec 05 03:00:07 2014] [error] [client 180.153.195.33] Premature end of script headers:
[Fri Dec 05 03:20:20 2014] [error] [client 76.14.162.37] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /tmUnblock.cgi
App 10140 stderr: [ 2014-12-05 03:46:21.5488 10221/0x00000000e1d2f0(Worker 1) utils.rb:84 ]: *** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`) (process 10221, thread 0x00000000e1d2f0(Worker 1)):
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:462:in `validate_secret_key_config!'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:195:in `env_config'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/engine.rb:510:in `call'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:144:in `call'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
[Fri Dec 05 03:46:21 2014] [error] [client 180.153.196.169] Premature end of script headers:
App 10140 stderr: [ 2014-12-05 04:26:21.9010 10221/0x00000000e1d2f0(Worker 1) utils.rb:84 ]: *** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`) (process 10221, thread 0x00000000e1d2f0(Worker 1)):
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:462:in `validate_secret_key_config!'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:195:in `env_config'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/engine.rb:510:in `call'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:144:in `call'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
App 10140 stderr: from /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
[Fri Dec 05 04:26:21 2014] [error] [client 171.13.14.23] Premature end of script headers:

UPD2: my_app/config/secrets.yml に秘密鍵を追加しました

ログファイルを削除して作成する

sudo rm -rf /var/log/apache2/error.log
sudo touch /var/log/apache2/error.log

Apache を再起動すると、次のエラーが再び表示されます。

ruslan@olga-blog:~/blog$ sudo service apache2 restart
Syntax error on line 273 of /etc/apache2/apache2.conf:
Invalid command 'PassengerDefaultRuby', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
 failed!

ログは空です

tail -f -n 100 /var/log/apache2/error.log

UPD3: 試行中 : sudo aptitude purge libapache2-mod-passenger
sudo apt-get install ruby​​gems build-essential apache2-prefork-dev libapr1-dev libssl-dev zlib1g-dev
sudo gem install Passenger
-install-apache2-module
出力を貼り付けますapache2.conf の終わり (上記のパッセンジャーに関する前の行は削除されました)

LoadModule passenger_module /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53/buildout/apache2/mod$
   <IfModule mod_passenger.c>
     PassengerRoot /home/ruslan/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.53
     PassengerDefaultRuby /home/ruslan/.rvm/gems/ruby-2.1.5/wrappers/ruby
   </IfModule>

Apache を再起動し、Apache メッセージが表示される

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

なんで?

UPD4

sudo nano /etc/apache2/mods-available/passenger.conf

空っぽに見える、なぜ?

UPD5:

apt-get install libapache2-mod-passenger

LoadModule の行を apache.conf から削除して、apache を再起動してもまだ

ruslan@olga-blog:~/blog$ sudo service apache2 restart

Syntax error on line 273 of /etc/apache2/apache2.conf:
Invalid command 'PassengerDefaultRuby', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
 failed!

UPD6:コマンド sudo パッセンジャー ステータスは次のように表示されます。

Version : 4.0.53
Date    : Fri Dec 05 10:34:32 +0000 2014
Instance: 1021
----------- General information -----------
Max pool size : 6
Processes     : 0
Requests in top-level queue : 0

----------- Application groups -----------
ruslan@olga-blog:~$ apachectl -t -D DUMP_MODULES|grep -i passenger
-bash: apachectl: command not found
ruslan@olga-blog:~$ apachectl configtest
-bash: apachectl: command not found
4

2 に答える 2

3

すべてを再インストールすると(ルビージェムのみの乗客)、正常に動作します。それで、それは私の「パッセンジャー+ apache + ruby​​のインストール方法」です:

  1. Apache をインストールします。

    sudo apt-get install apache2

  2. インストールrvm

    \curl -sSL https://get.rvm.io | bash -s 安定版

  3. rubygems を介してパッセンジャーをインストールします。

    gem install パッセンジャー

  4. Phusion Passenger インストーラーを実行する

    パッセンジャー インストール apache2 モジュール

  5. このようにラックアプリを作成します

    乗客ドキュメントの例

  6. VirtualHost ブロックを /etc/apache2/sites-enabled/rack_app に追加します

  7. PassengerRoot、PassengerDefaultRuby で /etc/apache2/mods-enabled/passenger.conf を作成します。

  8. LoadModule ブロックで /etc/apache2/mods-enabled/passenger.load を作成します

    sudo a2ensite rack_app sudo a2enmod パッセンジャー sudo サービス apache2 再起動

楽しむ!

詳細については、/etc/apache2/apache2.conf のコメントとPassenger Apache Docsを参照してください。

于 2014-12-05T15:22:34.217 に答える
1

私はこれについて推測するつもりです、私は問題がここにあるかもしれないと思います:

LoadModule passenger_module /home/ruslan/.rvm/gems/r$
<IfModule mod_passenger.c>
    PassengerRoot /home/ruslan/.rvm/gems/ruby-2.1.5/gem$
    PassengerDefaultRuby /home/ruslan/.rvm/gems/ruby-2.$
</IfModule>

/etc/apache2/httpd.confは持っています:

LoadModule passenger_module /Users/martin/.rbenv/versions/1.8.7-p374/lib/ruby/gems/1.8/gems/passenger-4.0.21/buildout/apache2/mod_passenger.so
PassengerRoot /Users/martin/.rbenv/versions/1.8.7-p374/lib/ruby/gems/1.8/gems/passenger-4.0.21
PassengerDefaultRuby /Users/martin/.rbenv/versions/1.8.7-p374/bin/ruby

端末ウィンドウの$幅が十分に広くないため、テキストが切り捨てられていることがわかります(したがって、正しい設定を持っている可能性がありますが、正しくコピーされていない可能性があります-端末ウィンドウのサイズを変更するか、右にスクロールして確認してください) または、apache パッセンジャー インストーラーを実行して、行全体ではなく切り捨てられたテキストをコピーしようとしたときにこのような状態になった場合は、apache mod インストーラーを再実行し、出力を正しくキャプチャして試してみることをお勧めします。

うまくいけば、それが事実であり、それは簡単な修正です.

アップデート

DocumentRoot "/Users/martin/Desktop/app_name/public"
<Directory "/Users/martin/Desktop/app_name/public">
    RailsEnv development
    Options -MultiViews
    AllowOverride all
    Allow from all
</Directory>

productionその場合は、開発の代わりに使用する必要があるかもしれませんがRailsEnv、投稿した構成のどこにもオプションが表示されませんが、問題は1つまたは2つしかないようなばかげたものになると思います.

デバッグに役立つコマンド:

apachectl configtest
cat /var/log/apache2/error_log

sudo passenger-status
apachectl -t -D DUMP_MODULES|grep -i passenger
于 2014-12-05T09:45:15.967 に答える