502 Bad Gateway- Nginx and thin

Yunior Miguel A. lists at ruby-forum.com
Mon Mar 18 15:12:58 UTC 2013

I have install nginx 1.1.19 and thin 1.5.0  in Ubuntu 12.04 and I am
install redmine, when I try to access the page of redmine gives me the
following error: 502 Bad Gateway. In Nginx log reads:
2013/03/18 10:45:09 [crit] 13886#0: *11 connect() to
unix:/tmp/thin.0.sock failed (2: No such file or directory) while
connecting to upstream, client:, server:
redmine_nginx.ipp.com, request: "GET / HTTP/1.1", upstream:
"http://unix:/tmp/thin.0.sock:/", host: "redmine_nginx.ipp.com"
thin configuration:

chdir: /var/www/redmine_nginx/
environment: production
port: 3000
timeout: 30
log: /var/log/thin/redmine.log
#pid: /var/run/thin/redmine.pid
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 512
require: []
wait: 30
servers: 1
daemonize: true
socket: /tmp/thin.sock
group: www-data
user: www-data

Nginx Service block:
upstream thin_cluster {
    server unix:/tmp/thin.0.sock;


server {

  listen   80; ## listen for ipv4

  # Set appropriately for virtual hosting and to use
  server_name  redmine_nginx.ipp.com;
  server_name_in_redirect off;

  access_log  /var/log/nginx/localhost.access.log;
  error_log  /var/log/nginx/localhost.error.log;

  # Note: Documentation says proxy_set_header should work in location
  #       block, but testing did not support this statement so it has
  #       been placed here in server block
  include /etc/nginx/proxy_opts;
  proxy_redirect off;

  # Note:  Must match the prefix used in Thin configuration for Redmine
  #        or / if no prefix configured
  location / {
    root   /var/www/redmine_nginx/public;

    error_page 404  404.html;
    error_page 500 502 503 504  500.html;
  try_files $uri/index.html $uri.html $uri @redmine_thin_servers;

  location @redmine_thin_servers {
    proxy_pass http://thin_cluster;

the include /etc/nginx/proxy_opts;

# Shared options used by all proxies
proxy_set_header        Host $http_host;

# Following headers are not used by Redmine but may be useful for
plugins and
# other web applications
proxy_set_header        X-Real-IP $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header        X-Forwarded-Proto $scheme;

# Any other options for all proxies here
client_max_body_size       10m;
client_body_buffer_size    128k;

proxy_connect_timeout      90;
proxy_send_timeout         90;
proxy_read_timeout         90;

proxy_buffer_size          4k;
proxy_buffers              4 32k;
proxy_busy_buffers_size    64k;
proxy_temp_file_write_size 64k;

Posted via http://www.ruby-forum.com/.

More information about the nginx mailing list