Ubuntu : 12.04 LTS
Ruby : 1.9.3
Passenger : 4.0.45
在安裝完 apache 2.2 後,不要對 apache 設定檔進(jìn)行任何修改,在安裝 Passenger 實(shí)會(huì )修改 Apache 核心及設定檔,若有自己的設定檔,請自行備份,確認不要被新的設定檔覆蓋了
$ gem install passenger$ passenger-install-apache2-module安裝過(guò)程會(huì )檢查所需要的套件,如果發(fā)生錯誤,請依照 Passenger 的指示,安裝其需要的套件
Checking for required software... * Checking for C compiler... Found: yes Location: /usr/bin/cc * Checking for C++ compiler... Found: yes Location: /usr/bin/c++ * Checking for Curl development headers with SSL support... Found: no Error: Cannot find the `curl-config` command. * Checking for OpenSSL development headers... Found: yes Location: true * Checking for Zlib development headers... Found: yes Location: true * Checking for Apache 2... Found: yes Location of httpd: /usr/sbin/apache2 Apache version: 2.2.22 * Checking for Apache 2 development headers... Found: no * Checking for Rake (associated with /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/ruby)... Found: yes Location: /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/rake * Checking for OpenSSL support for Ruby... Found: yes * Checking for RubyGems... Found: yes * Checking for Ruby development headers... Found: yes Location: /usr/local/rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1/ruby.h * Checking for rack... Found: yes * Checking for Apache Portable Runtime (APR) development headers... Found: no * Checking for Apache Portable Runtime Utility (APU) development headers... Found: noSome required software is not installed.But don't worry, this installer will tell you how to install them.Press Enter to continue, or Ctrl-C to abort.--------------------------------------------Installation instructions for required software * To install Curl development headers with SSL support: Please run apt-get install libcurl4-openssl-dev or libcurl4-gnutls-dev, whichever you prefer. * To install Apache 2 development headers: Please install it with apt-get install apache2-threaded-dev * To install Apache Portable Runtime (APR) development headers: Please install it with apt-get install libapr1-dev * To install Apache Portable Runtime Utility (APU) development headers: Please install it with apt-get install libaprutil1-dev我這邊欠缺的套件為下列套件,所以需要再重新安裝
$ sudo apt-get install libcurl4-openssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev重新安裝完套件後,再次執行passenger-install-apache2-module安裝 Apache Passenger 套件即可
安裝過(guò)程會(huì )需要編譯 apache 套件,所以需要一點(diǎn)時(shí)間
這??要特別注意,因為passenger會(huì )一直更新版本,以下的設定千萬(wàn)不要直接拿去貼上,否則會(huì )出現錯誤。請直接複製在apache-passenger後在螢幕上顯示的文字。
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so<IfModule mod_passenger.c> PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.45 PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/ruby</IfModule>建立新的設定檔passenger.conf
$ sudo vim /etc/apache2/conf.d/passenger.conf貼上上面 Passenger 產(chǎn)生的設定檔
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so<IfModule mod_passenger.c> PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.45 PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/ruby</IfModule>接下來(lái)會(huì )安裝 Redmine 當作測試程式,所以以下以redmine做設定範例
建立虛擬主機設定檔redmine
sudo vim /etc/apache2/sites-available/redmine虛擬主機設定
<VirtualHost *:80> ServerName dev.redmine # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /usr/share/redmine/public <Directory /usr/share/redmine/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: #Require all granted </Directory></VirtualHost>$ sudo a2ensite redmineEnabling site redmine.To activate the new configuration, you need to run: service apache2 reload$ sudo service apache2 reload
聯(lián)系客服