redmine + apache + mod_fcgid
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.gz wget http://mirrors.hust.edu.cn/apache//httpd/mod_fcgid/mod_fcgid-2.3.9.tar.gz
二. 编译apache
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_fcgid
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到apache
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>
修改为
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添加到服务,就可以随系统重启了
博客地址:http://www.cnblogs.com/wzy5223