ruby2.1+ Redmine2.5+nginx configuration in Linux

Source: Internet
Author: User

Installed on the same server redmine and Gitlab configuration Redmine + nginx all kinds of toss

Startup method 1:ruby Script/rails Server webrick-e production-d default test program configuration Well, there's no way to go without a lot of people.

Startup method 2:ruby Script/rails Server mongrel-e production-d-p3000 slightly more, but the masses still say slow.

A study of Nginx methods

1: Preparation with Mongrel + Nginx method did not toss success to give up

Install Nginx

The version I downloaded is nginx-0.8.40.tar.gz

Decompression Installation

TAR-ZXVF nginx-0.8.40.tar.gz
CD nginx-0.8.40/
. Configure
Make
sudo make install
The installation directory by default is/usr/local/nginx

Install Mongrel and Mongrel_cluster
sudo gem install mongrel Mongrel_cluster
Since the Mongrel_rails command was placed in/var/lib/gems/1.8/bin/mongrel_rails after the gem was installed, it is recommended that symbolic links be established

sudo ln-s/var/lib/gems/1.8/bin/mongrel_rails/usr/bin/mongrel_rails
Deploying Rails Applications
My application example is Redmine, a project management tool made with rails. Redmine installation path is/opt/redmine

Configure Nginx to add a server block for service Redmine

Edit Vi/usr/local/nginx/conf/nginx.conf, here's what you added

Upstream Mongrel {
Server 127.0.0.1:8000;
Server 127.0.0.1:8001;
}

# Rails Server
server {
Listen 80;
server_name redmine.moon.ossxp.com;
Root/opt/redmine/public; #注意这里一定要指向Rails应用的public目录
Index index.html index.htm;

Location/{
Proxy_pass Http://mongrel;
Proxy_redirect off;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}
}
Configure Mongrel_cluster

Execute the following command under the root directory of the Rails project to generate the Config/mongrel_cluster.yml file for mongrel cluster use

sudo mongrel_rails cluster::configure-e production-p 8000-a 127.0.0.1-n 2
For more cluster::configure parameters use the help command to view

Mongrel_rails cluster::configure-h
The resulting file contents are as follows:

---
address:127.0.0.1
Log_file:log/mongrel.log
Port: "8000"
Environment:production
Pid_file:tmp/pids/mongrel.pid
Servers:2
Enable Mongrel_cluster

wangsheng@pc01:/opt/redmine$ sudo mongrel_rails cluster::start
Starting Port 8000
Starting Port 8001
Enable Nginx

Sudo/usr/local/nginx/sbin/nginx

Test if deployment succeeded

Enter server_name in the browser (I'm using redmine.moon.ossxp.com here), press ENTER, and if the Redmine home page is displayed, then prove the deployment is successful

Error occurred: em_plugin.rb:109:in ' load ': Uninitialized constant Gem::sourceindex (nameerror)


2: With Unicorn + nginx

Reference: http://blog.davidanguita.name/2013/03/03/setting-up-a-cheap-redmine-server-using-unicorn-and-apache/ or similar and domestic blog started when the failure

Command: unicorn_rails-c shared/config/redmine/unicorn.rb-p 5000-e production-d

Error occurred: Runtime.rb:34:in ' block in Setup ': Your have already activated rack 1.5.2, but your gemfile, requires rack. Prepending ' bundle exec ' to your command could solve this. (Gem::loaderror)

is also a variety of search did not solve, because Gitlab and this in the same server has several articles let uninstall 1.5.2 not dare to move the search to the following this article toss the next success

Reference: HTTP://QIITA.COM/ISSOBERO/ITEMS/4CA5BB5F8508C25C8D45

Use command: Bundle exec unicorn_rails-e production-c config/unicorn.rb-d

If you don't know Ruby, you can simply record the convenience of the students who are experiencing problems.

PS to the configuration here is finished, the article has two foreign address small set up, we can go to the address to see.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.