redmine + apache + mod_fcgid

 

redmine默認是用webrick啓動的,這種方法不適合生產環境,最好部署在apache下,本文介紹如何經過mod_fcgid啓動。html

首先要有一個可以啓動的redmine,能夠經過我以前的博文查看: http://www.cnblogs.com/wzy5223/p/5335549.htmlweb

本例redmine的安裝位置:/opt/redmine-3.2.1apache

 

一. 下載資源ruby

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.31.tar.gz
wget http://mirrors.hust.edu.cn/apache//httpd/mod_fcgid/mod_fcgid-2.3.9.tar.gz

二. 編譯apacheapp

tar xzvf httpd-2.2.31.tar.gz
cd httpd-2.2.31
./configure --prefix=/opt/httpd-2.2.31 --enable-rewrite
make
make install

三. 編譯mod_fcgidcurl

tar xzvf mod_fcgid-2.3.9.tar.gz
cd mod_fcgid-2.3.9
APXS=/opt/httpd-2.2.31/bin/apxs ./configure.apxs
make
make install

四. 配置redmine到apacheide

cd /opt/redmine-3.2.1/public
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess

cd cd /opt/httpd-2.2.31/conf
vi 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>

修改成ui

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>

並修改監聽端口爲3000url

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添加到服務,就能夠隨系統重啓了

相關文章
相關標籤/搜索