0

I am trying to install redmine on my Ubuntu 14.04 machine. I already have an nginx 1.8.1 server running so I need to use it with that. I have followed a bunch of tutorials on how to do it as I have zero experience with the ruby environment. After I installed and configured everything I get an error in nginx when I try to access the redmine instance:

2016/03/22 21:52:54 [crit] 6640#0: *253 connect() to unix:/var/sockets/thin.2.sock failed (2: No such file or directory) while connecting to upstream, client: <EDIT>, server: <EDIT>, request: "GET / HTTP/1.1", upstream: "http://unix:/var/sockets/thin.2.sock:/", host: "<EDIT>"
2016/03/22 21:52:54 [crit] 6640#0: *253 connect() to unix:/var/sockets/thin.1.sock failed (2: No such file or directory) while connecting to upstream, client: <EDIT>, server: <EDIT>, request: "GET / HTTP/1.1", upstream: "http://unix:/var/sockets/thin.1.sock:/", host: "<EDIT>"
2016/03/22 21:52:54 [crit] 6640#0: *253 connect() to unix:/var/sockets/thin.0.sock failed (2: No such file or directory) while connecting to upstream, client: <EDIT>, server: <EDIT>, request: "GET / HTTP/1.1", upstream: "http://unix:/var/sockets/thin.0.sock:/", host: "<EDIT>"

So, what I am doing now:
1. Start thin with three servers, as exemplified on this website:

$ sudo thin start -s3 --socket /var/sockets/thin.sock
Starting server on /var/sockets/thin.0.sock ...
Starting server on /var/sockets/thin.1.sock ...
Starting server on /var/sockets/thin.2.sock ...
  1. Restart nginx

The /var/sockets/ directory exists and for now I have given it chmod 777 permissions. Even though thin does not give any errors I cannot see any .sock files in there (maybe they are private?).

Also, here is my nginx host file:

upstream thin_cluster {
    server unix:/var/sockets/thin.0.sock;
    server unix:/var/sockets/thin.1.sock;
    server unix:/var/sockets/thin.2.sock;
    #server unix:/tmp/thin.3.sock;
    #server unix:/tmp/thin.4.sock;
}
server {
    listen       80;
    server_name  <EDIT>;

    root /usr/share/redmine/public;

    location / {
      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;

      if (-f $request_filename/index.html) {
        rewrite (.*) $1/index.html break;
      }
      if (-f $request_filename.html) {
        rewrite (.*) $1.html break;
      }
      if (!-f $request_filename) {
        proxy_pass http://thin_cluster;
        break;
      }
    }

    #error_page   500 502 503 504  /50x.html;
    #location = /50x.html {
    #  root   html;
    #}
  }
Drifter104
  • 3,693
  • 2
  • 22
  • 39
Comforse
  • 117
  • 7

1 Answers1

0

It's trying to connect to http://unix:socket - that's probably the problem. Look at the configuration settings for nginx to fix your configuration. It's probably this

proxy_pass http://thin_cluster;

I think proxy_pass can only send to another HTTP server, but you're trying to sent it to a Unix socket. That works for PHP, but not for proxy_pass. Replace that with

proxy_pass http://your-server-url

I can't rule out other misconfigurations. Try it and report back what happens.

Tim
  • 30,383
  • 6
  • 47
  • 77
  • I tried both your suggestions before and after you edited. With my subdomain as proxy pass I get an ``invalid URL prefix`` error while with the edited suggestion i get ``768 worker_connections are not enough while connecting to upstream``. – Comforse Mar 22 '16 at 22:02
  • Now you need to do some basic problem solving. Look in the applicable logs, go back to basics and use CURL and such. If you need more help you need to give a high level view of servers and services you use, correlated access and error logs, and what happens. Also update your nginx config above. – Tim Mar 22 '16 at 23:33