rdmine_unicorn_cent_nginx_.png

#!/bin/sh
/usr/bin/perl /root/scripts/rununicorn.pl

#! /usr/bin/perl -w
use strict;
use warnings;

print "running helpdesk\n";
$ENV{PATH}='/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin:/home:/var/www/html/redmine/config';
print $ENV{'PATH'};
system ("BUNDLE_GEMFILE=/var/www/html/redmine/Gemfile bundle exec unicorn_rails -E production -c /var/www/html/redmine/config/unicorn.rb -D");

nginx as revers proxy

upstream redmine {
    server unix:/var/www/html/redmine/tmp/sockets/unicorn.sock;
    }

     server {
         listen 80;
         server_name example.com;
         client_max_body_size 200m;
         root /var/www/html/redmine/;

      location / {
          try_files $uri @ruby;
                  }

       location ~* \.(jpg|gif|png|js|css|ico)$ {
               root /var/www/html/redmine/public;
               expires 7d;
               error_page 404 502 504 = @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 300;
        proxy_pass http://redmine; #upstream redmine
        }
    }