运行后
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 的末尾我有:(这行是我在乘客安装 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/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 我有:
内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求。
请联系服务器管理员,[未提供地址] 并告知他们错误发生的时间,以及您可能所做的任何可能导致错误的事情。
服务器错误日志中可能提供有关此错误的更多信息。
Apache/2.2.22 (Debian) 服务器在 146.148.7.236 端口 80
有什么问题?(如果重要的话,我在 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 rubygems build-essential apache2-prefork-dev libapr1-dev libssl-dev zlib1g-dev
sudo gem install Passenger 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
从 apache.conf 中删除 LoadModule 行重新启动 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 Passenger-status 显示:
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