2014-12-04 97 views
0

后,我有客运+的Apache +红宝石

[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结束时,我有:(此线后,我得到了乘客安装-Apache2的模块)

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// 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我有:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/2.2.22 (Debian) Server at 146.148.7.236 Port 80

什么可能是一个问题? (如果它很重要,我在Google Developers Console上使用Debian)

我也注意到同样的问题here,但我找不到差异。

UPD: 我的apache.conf结束,其中包含

LoadModule passenger_module 

和删除的行现在我有这样的错误:

[email protected]:~$ 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 log with tail -f -n 100 /var/log/apache2/error.log(冷杉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应用/配置/ secrets.yml

删除日志文件,并创建

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

重启Apache,并有再次出现此错误:

[email protected]:~/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: TRYING: 须藤性向净化中的libapache2-MOD-乘客
命令和apt-get安装的RubyGems建立必要的Apache2-prefork的-dev的libapr1-dev的的libssl-dev的的zlib1g-dev的
sudo的创业板安装乘客
passenger-install-apache2-module
将输出粘贴到apache2的末尾。配置(以上关于乘客前面的行删除)

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的又来了,有阿帕奇消息

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:从的apache.conf 重启Apache

apt-get install libapache2-mod-passenger 

删除的LoadModule线 ,仍然有

[email protected]:~/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 ----------- 
[email protected]:~$ apachectl -t -D DUMP_MODULES|grep -i passenger 
-bash: apachectl: command not found 
[email protected]:~$ apachectl configtest 
-bash: apachectl: command not found 

回答

1

我都重新安装(只能通过RubyGems的乘客),它工作正常。 所以,这是我的 '如何安装客运+ APACHE +红宝石':

  1. 安装Apache:

    sudo易于得到安装的Apache2

  2. 安装RVM

    \卷曲-sSL https://get.rvm.io |庆典通过RubyGems的-s稳定

  3. 安装乘客:

    创业板安装乘客

  4. 运行的Phusion客运安装

    乘客安装-Apache2的模块

  5. 创建您的机架这样的应用程序

    in passenger doc example

  6. 添加虚拟主机块/ rack_app

  7. 的/ etc/apache2的/启用的网站,与PassengerRoot创建/etc/apache2/mods-enabled/passenger.conf, PassengerDefaultRuby

  8. 创建的/ etc用的LoadModule 块/apache2/mods-enabled/passenger.load

    须藤a2ensite rack_app 须藤a2enmod乘客 须藤服务的Apache2重启

玩得开心!

欲了解更多详细信息,请参阅/etc/apache2/apache2.conf中的意见,并Passenger Apache Docs

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乘客安装程序并前往co py截断的文本,而不是完整的行,我建议重新运行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选择任何地方,您张贴的配置,但我觉得你的问题是会成为一个愚蠢的事情,你只会失去一两件事情。

一些命令,这可能有助于调试:

apachectl configtest 
cat /var/log/apache2/error_log 

sudo passenger-status 
apachectl -t -D DUMP_MODULES|grep -i passenger 
+0

感谢响应!不,$ - 被纳米截断,我更新了我的答案(请参见UPD3) – user1028432 2014-12-05 09:53:31

+0

啊,这几乎使我的答案无用,那么我会发布我的目录设置,看看是否有帮助。 – martincarlin87 2014-12-05 10:00:12