在 ubuntu 中使用 apache2 托管 redmine 服务器

在 ubuntu 中使用 apache2 托管 redmine 服务器

我正在尝试在 Ubuntu 机器上使用 apache 运行 redmine+gitolite 服务器。我按照说明操作给出使用以下服务器配置文件:

<VirtualHost *:80>
        ServerName redmine.xyz.com

        ServerAdmin someone@somewhere
        DocumentRoot /var/www/
        PassengerUserSwitching on
        RewriteEngine On
        RewriteRule ^/?$ /redmine [R]

        <Directory /var/www/redmine>
                RailsBaseURI /redmine
                PassengerResolveSymlinksInDocumentRoot on
                PassengerUser redmine
                PassengerGroup redmine
        </Directory>
        LogLevel info

        ErrorLog ${APACHE_LOG_DIR}/error-redmine.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

现在,当我访问该网站时,默认error.log文件中会记录以下内容:

[ 2015-11-07 12:44:45.7366 1568/7f9da7df9780 agents/HelperAgent/Main.cpp:643 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.1562/generation-0/request
[ 2015-11-07 12:44:45.7422 1574/7faddd156780 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.1562/generation-0/logging
[ 2015-11-07 12:44:45.7424 1563/7f018bf01780 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[Sat Nov 07 12:44:45.743089 2015] [mpm_event:notice] [pid 1562:tid 139811192584064] AH00489: Apache/2.4.7 (Ubuntu) Phusion_Passenger/4.0.37 configured -- resuming normal operations
[Sat Nov 07 12:44:45.743162 2015] [core:notice] [pid 1562:tid 139811192584064] AH00094: Command line: '/usr/sbin/apache2'
App 1677 stdout:
App 1677 stderr:  --> No passenger_native_support.so found for current Ruby interpreter.
App 1677 stderr:      This library provides various optimized routines that make
App 1677 stderr:      Phusion Passenger faster. Please run 'sudo apt-get install passenger-dev'
App 1677 stderr:      so that Phusion Passenger can compile one on the next run.
App 1677 stderr:  --> Continuing without passenger_native_support.so.
App 1677 stderr: /var/lib/gems/2.2.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot"
[ 2015-11-07 12:45:17.4620 1568/7f9da7d02700 Pool2/SmartSpawner.h:301 ]: Preloader for /opt/redmine started on PID 1677, listening on unix:/tmp/passenger.1.0.1562/generation-0/backends/preloader.1677
App 1697 stdout:
App 1677 stderr: /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:356:in `trap'
App 1677 stderr: : Invalid argument - SIGKILL (Errno::EINVAL)
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:356:in `block in reset_signal_handlers'
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:354:in `each_key'
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:354:in `reset_signal_handlers'
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:182:in `main_loop'
App 1677 stderr:        from /usr/share/passenger/helper-scripts/rack-preloader.rb:161:in `<module:App>'
App 1677 stderr:        from /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
App 1677 stderr:        from /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
[ 2015-11-07 12:45:18.0075 1568/7f9da7de6700 Pool2/Pool.h:777 ]: Process (pid=1697, group=/opt/redmine#default) no longer exists! Detaching it from the pool.
App 1706 stdout:
App 1677 stderr: /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:356:in `trap'
App 1677 stderr: : Invalid argument - SIGKILL (Errno::EINVAL)
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:356:in `block in reset_signal_handlers'
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:354:in `each_key'
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:354:in `reset_signal_handlers'
App 1677 stderr:        from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:182:in `main_loop'
App 1677 stderr:        from /usr/share/passenger/helper-scripts/rack-preloader.rb:161:in `<module:App>'
App 1677 stderr:        from /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
App 1677 stderr:        from /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'

并在自定义中如下error-redmine.log

[Sat Nov 07 12:45:17.629247 2015] [core:error] [pid 1584:tid 139811078739712] [client 106.51.26.94:30565] End of script output before headers: redmine

使用以下命令启动时服务器正在运行:

bundle exec rails server -d -e production

Apache 失败的原因可能是什么?我已启用passengerrewrite模块。命令

sudo apt-get install passenger-dev

就像error.log失败的说法:

无法找到包passenger-dev

答案1

通过安装 gem 解决了这个问题passenger。服务器现在使用它而不是mod-passenger(或phusion-passenger)。因此,基本上,以下命令解决了这个问题:

sudo gem install passenger
sudo a2dismod passenger

就这样。

我很想听听两者之间的区别。

相关内容