Search code examples
nginxredminethin

redmine installation not working through nginx and thin


I've installed Redmine on an Ubuntu 13.04 server. This installation worked fine and I confirmed Redmine was working through the WEBrick server (as per redmine documentation).

To make things more stable I want to run Redmine behind Nginx & Thin.

With this part I run into problems as Nginx reports getting timeouts:

2013/07/19 07:47:32 [error] 1051#0: *10 upstream timed out (110: Connection timed out) while connecting to upstream, .......

Thin Configuration:

---
chdir: /home/redmine/app/redmine
environment: production
address: 127.0.0.1
port: 3000
timeout: 5
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 128
max_persistent_conns: 64
require: []
wait: 10
servers: 1
daemonize: true

I can see Thin is running, the pid file is created and a logfile is started. I see no further additions to the logfile when doing requests.

Nginx configuration:

upstream redmine {
        server 127.0.0.1:3000;
}

server {
        server_name redmine.my.domain;
        listen 443;

        ssl on;
        ssl_certificate /home/redmine/sites/redmine/certificates/server.crt;
        ssl_certificate_key /home/redmine/sites/redmine/certificates/server.key;

        access_log /home/redmine/sites/redmine/logs/server.access.nginx.log;
        error_log /home/redmine/sites/redmine/logs/server.error.nginx.log;

        root /home/redmine/app/redmine;

        location / {
                try_files $uri @ruby;
        }

        location @ruby {
                proxy_set_header  X-Real-IP  $remote_addr;
                proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header  Host $http_host;
                proxy_redirect off;
                proxy_read_timeout 5;
                proxy_pass http://redmine;
        }
}

I can see additions to the Nginx log.

Can anyone give me a hint on where to find the problem in this?

Current result of iptables -L

Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3000
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

Solution

  • The error is because your firewall "iptables" blocked the port.

    Rollback your iptables config, then issue the follow command:

    iptables -I INPUT -i lo -p tcp --dport 3123 -j ACCEPT
    

    Remember to save the setting by:

    service iptables save
    

    More information about iptables: https://help.ubuntu.com/community/IptablesHowTo

    p.s. sudo may be needed for the above commands.