zoukankan      html  css  js  c++  java
  • Nginx下Redmine2.6配置

    Apache下Redmine2.6配置,请参考:http://blog.linuxeye.com/405.html
    CentOS6.6下安装Redmine2.6+MySQL5.6+Nginx,教程如下:
    1. 初始环境
    系统版本:CentOS-6.6-x86_64-minimal.iso
    安装LNMP,参考《lnmp一键安装包》;修改options.conf,home_dir=/data/wwwroot

    2. ruby安装

    cd lnmp/src
    wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
    tar xzf ruby-2.1.5.tar.gz
    cd ruby-2.1.5
    ./configure --prefix=/usr/local/ruby
    make && make install
    cd ..

    添加到环境变量

    vi /etc/profile
    export PATH=/usr/local/ruby/bin:$PATH
    . /etc/profile

    查看ruby版本号

    # ruby -v
    ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

    3. 安装rails

    #安装gem
    wget http://production.cf.rubygems.org/rubygems/rubygems-2.4.5.tgz
    tar xzf rubygems-2.4.5.tgz
    cd rubygems-2.4.5
    ruby setup.rb
    cd ..

    提示:gem是一种文件组织的包,一般的ruby的很多插件都有由这种各种的包提供。

    # gem -v
    2.4.5
    # which gem
    /usr/local/ruby/bin/gem

    由于国内网络原因(你懂的),导致rubygems.org存放 Amazon S3上面的资源文件间歇性连接失败。所以你会与遇到gem install rack或bundle install的时候半天没有响应,具体可以用gem install rails -V来查看执行过程。下面替换成淘宝的GEM镜像站:

    # gem sources -l
    *** CURRENT SOURCES ***
    
    https://rubygems.org/
    
    # gem sources --remove https://rubygems.org/
    https://rubygems.org/ removed from sources
    # gem sources -a https://ruby.taobao.org/
    https://ruby.taobao.org/ added to sources
    # gem sources -l
    *** CURRENT SOURCES ***
    
    https://ruby.taobao.org/

    Redmine需要考虑Ruby版本兼容性问题,请参考:Installing Redmine

    Redmine version Supported Ruby versions Rails version used
    current trunk ruby 1.9.3, 2.0.0, 2.1, jruby-1.7.6 Rails 4.1
    trunk < r13482 ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1, jruby-1.7.6 Rails 3.2
    2.5, 2.6 ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1, jruby-1.7.6 Rails 3.2
    2.4 ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, jruby-1.7.6 Rails 3.2

    Redmine选择安装2.6版本,因此rails安装3.2版本

    gem install rails -v=3.2
    
    # rails -v
    Rails 3.2.19

    4. 安装redmine2.6

    wget http://www.redmine.org/releases/redmine-2.6.1.tar.gz
    tar xzf redmine-2.6.1.tar.gz -C /data/wwwroot
    mv /data/wwwroot/redmine{-2.6.1,}

    创建redmine数据库

    cd /data/wwwroot/redmine
    # mysql -uroot -p
    mysql> create database redmine;

    make sure to install the C bindings for Ruby that dramatically improve performance. You can get them by running gem install mysql2.

    配置Redmine的database.yml

    cd /data/wwwroot/redmine/config
    cp database.yml.example database.yml
    cat database.yum #修改对应数据库连接信息
    production:
      adapter: mysql2
      database: redmine
      host: localhost
      username: root
      password: "linuxeye"
      encoding: utf8

    安装redmine依赖的所有ruby包

    cd ..
    gem install bundler #注意是在网站根目录下执行
    bundle install --without development test rmagick #完成redmine依赖包的安装

    bundler是用来管理ruby的包依赖的工具

    为Rails生成cookies秘钥

    rake generate_secret_token

    创建数据库结构

    RAILS_ENV=production rake db:migrate

    生成缺省数据

    RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data

    调整文件系统权限

    cd /data/wwwroot/redmine
    mkdir -p tmp tmp/pdf public/plugin_assets
    chown -R www.www /data/wwwroot/redmine

    tmp和tmp/pdf (若不存在则创建该路径,用于生成 PDF 文件);public/plugin_assets (若不存在则创建该路径,plugins资源)

    5. 在WEBrick服务上测试Redmine是否安装成功

    # vi /etc/passwd #使www用户有bash权限,lnmp脚本安装www用户没有bash权限
    www:x:501:501::/home/www:/bin/bash
    # su www -c "ruby script/rails server webrick -e production -d"

    地址:http://IP:3000 (注意:打开iptables 3000端口号)
    缺省管理员用户:

    • login: admin
    • password: admin

    如果验证成功,则继续下面的步骤来使Redmine运行在Apache服务上

    6.  配置Redmine在Nginx上运行
    结束webrick服务

    cd /data/wwwroot/redmine/public/
    cp dispatch.fcgi.example dispatch.fcgi
    cp htaccess.fcgi.example .htaccess
    chown -R www.www ./*

    安装Passenger(用于整合Nginx

    gem install passenger
    passenger-install-nginx-module

    重新编译Nginx

    cd ~/lnmp/src
    cd nginx-1.6.2
    /usr/local/nginx/sbin/nginx -V #查看已经编译参数
    #在其后加上--add-module=/usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-4.0.57/ext/nginx参数,我的编译参数如下
    ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module 
    --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module 
    --with-http_flv_module --with-ld-opt=-ljemalloc 
    --add-module=/usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-4.0.57/ext/nginx
    make
    mv /usr/local/nginx/sbin/nginx{,_`date +%m%d`}
    cp objscp objs/nginx /usr/local/nginx/sbin/

    配置Nginx
    vi /usr/local/nginx/conf/nginx.conf#在http {}直接添加

    passenger_root /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-4.0.57;
    passenger_ruby /usr/local/ruby/bin/ruby;

    添加虚拟主机(/usr/local/nginx/conf/vhost/bugs.linuxeye.com.conf)如下:

    server {
    listen 80;
    server_name bugs.linuxeye.com;
    access_log /data/wwwlogs/bugs.linuxeye.com_nginx.log combined;
    index index.html index.htm index.jsp index.php;
    include none.conf;
    root /data/wwwroot/redmine/public;
    passenger_enabled on;
    }

    原文:http://blog.linuxeye.com/407.html

  • 相关阅读:
    Spring EL Operators example
    Spring EL method invocation example
    Spring EL hello world example
    Spring @PostConstruct and @PreDestroy example
    Spring init-method and destroy-method example
    Define custom @Required-style annotation in Spring
    Spring dependency checking with @Required Annotation
    Spring properties dependency checking
    UESTC 883 方老师与两个串 --二分搜索+DP
    UESTC 882 冬马党 --状压DP
  • 原文地址:https://www.cnblogs.com/lj2007331/p/4224284.html
Copyright © 2011-2022 走看看