標籤:
redmine預設是用webrick啟動的,這種方法不適合生產環境,最好部署在apache下,本文介紹如何通過mod_fcgid啟動。
首先要有一個能夠啟動的redmine,可以通過我之前的博文查看: http://www.cnblogs.com/wzy5223/p/5335549.html
本例redmine的安裝位置:/opt/redmine-3.2.1
一. 下載資源
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.31.tar.gzwget http://mirrors.hust.edu.cn/apache//httpd/mod_fcgid/mod_fcgid-2.3.9.tar.gz
二. 編譯apache
tar xzvf httpd-2.2.31.tar.gzcd httpd-2.2.31./configure --prefix=/opt/httpd-2.2.31 --enable-rewritemakemake install
三. 編譯mod_fcgid
tar xzvf mod_fcgid-2.3.9.tar.gzcd mod_fcgid-2.3.9APXS=/opt/httpd-2.2.31/bin/apxs ./configure.apxsmakemake install
四. 配置redmine到apache
cd /opt/redmine-3.2.1/publiccp dispatch.fcgi.example dispatch.fcgicp htaccess.fcgi.example .htaccesscd cd /opt/httpd-2.2.31/confvi httpd.conf
找到下面的內容
DocumentRoot "/opt/httpd-2.2.31/htdocs"## Each directory to which Apache has access can be configured with respect# to which services and features are allowed and/or disabled in that# directory (and its subdirectories).## First, we configure the "default" to be a very restrictive set of# features.#<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all</Directory>
修改為
DocumentRoot "/opt/redmine-3.2.1/public"## Each directory to which Apache has access can be configured with respect# to which services and features are allowed and/or disabled in that# directory (and its subdirectories).## First, we configure the "default" to be a very restrictive set of# features.#<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all</Directory>
並修改監聽連接埠為3000
Listen 3000
五. 安裝mod_passenger
gem install passenger
yum install libcurl-devel
passenger-install-apache2-module --apxs2-path /opt/httpd-2.2.31/bin/apxs --apr-config-path /opt/httpd-2.2.31/bin/apr-1-config --languages ruby
上面的命令最後會有一段字元需要添加到httpd.conf,例如下面
LoadModule passenger_module /home/wzy/.rvm/gems/ruby-2.2.4/gems/passenger-5.0.26/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/wzy/.rvm/gems/ruby-2.2.4/gems/passenger-5.0.26 PassengerDefaultRuby /home/wzy/.rvm/gems/ruby-2.2.4/wrappers/ruby </IfModule>
六. 啟動apache,測試是否能訪問 http://<IP>:3000
/opt/httpd-2.2.31/bin/apachectl start
如果能成功訪問就大功告成了,最後可以將apache添加到服務,就可以隨系統重啟了
redmine + apache + mod_fcgid