17
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UbuntuにRedmine + Unicorn + nginxの環境を構築する

Last updated at Posted at 2015-04-13

以下の投稿を見て、Ubuntu版を試しにインストールした。
http://qiita.com/mozo/items/6ec0151dad350c051399

この投稿は自分用メモ + 試行錯誤中であることを先に述べておく。
なので、随時修正、更新します。

環境まとめ

項目 内容(バージョンなど)
ubuntu 14.04(64bit)
redmine 3.0.1
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
gem 2.4.6
environment production
DB MySQL 5.5.41-0ubuntu0.14.04.1 (Ubuntu)
アプリディレクトリ /usr/local/app/redmine-3.0.1
URL http://[localhost]:3000

gccのインストール

$ sudo apt-get install -y build-essential

nginxのインストール

$ sudo apt-get install -y nginx

MySQLとか

$ sudo apt-get install -y mysql-server

$ sudo apt-get install libmysqld-dev

$ sudo apt-get install -y libssl-dev

$ sudo apt-get install -y libreadline6-dev

$ sudo apt-get install -y zlib1g-dev

$ sudo apt-get install -y libcurl4-openssl-dev

$ sudo apt-get install -y curl

$ sudo apt-get install -y libyaml-dev

$ sudo apt-get install -y ruby

gemのアップデート

$ sudo gem install rubygems-update

$ sudo update_rubygems

bundlerのインストール

$ sudo gem install bundler --no-rdoc --no-ri

$ gem install daemon_controller rack passenger --no-rdoc --no-ri

MySQLの設定

$ mysql -u root -p

mysql> create database db_redmine default character set utf8;

mysql> grant all on db_redmine.* to user_redmine@localhost identified by '********';
mysql> flush privileges;
mysql> exit

Redmineモジュール

$ wget http://www.redmine.org/releases/redmine-3.0.1.tar.gz
$ tar xzvf redmine-3.0.1.tar.gz
$ sudo mkdir /usr/local/app/
$ sudo mv redmine-3.0.1 /usr/local/app/redmine-3.0.1
$ cd /usr/local/app/redmine-3.0.1/

DBの設定

$ sudo cp config/database.yml.example config/database.yml

$ sudo vim config/database.yml

config/database.yml
production:
  adapter: mysql2
  database: db_redmine
  host: localhost
  username: user_redmine
  password: "********"
  encoding: utf8

$ bundle install --without development test rmagick --path vendor/bundle

$ sudo apt-get install -y ruby-dev

nginxのモジュールをインストールする

$ sudo passenger-install-nginx-module

/etc/nginx/sites-available/redmine
upstream redmine {
        server unix:/usr/local/app/redmine-3.0.1/tmp/unicorn.sock fail_timeout=0;
}
server {
        location ~ / {
                root /usr/local/app/redmine-3.0.1/;
                if (-f $request_filename) {
                        break;
                }

                proxy_read_timeout 300;
                proxy_connect_timeout 300;
                proxy_redirect     off;

                proxy_set_header   X-Forwarded-Proto $scheme;
                proxy_set_header   Host              $http_host;
                proxy_set_header   X-Real-IP         $remote_addr;
                proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
                proxy_set_header   Host $host;

                proxy_pass         http://redmine;

                access_log  /var/log/nginx/redmine_access.log;
                error_log   /var/log/nginx/redmine_error.log;
        }
}
  • シンボリックリンクをはる

$ sudo ln -s /etc/nginx/sites-available/redmine /etc/nginx/sites-enabled/

起動する

$ bundle exec unicorn_rails -l 3000 -E production &

アクセスする

初回ログイン時のIDとパスワードはadminでログインでできるようです。
外部へ公開する場合は必ず、パスワードは変更してください。

17
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?