Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been moving my installation from 0.8 to 1.0.10 version and I have found that my old config stops working:

vm-tracker:/etc/nginx # /etc/init.d/nginx start
redirecting to systemctl
Job failed. See system logs and 'systemctl status' for details.

vm-tracker:/etc/nginx # /etc/init.d/nginx status
redirecting to systemctl
nginx.service - LSB: nginx
      Loaded: loaded (/etc/init.d/nginx)
      Active: failed since Sun, 22 Jul 2012 10:04:31 +0400; 2s ago
     Process: 2506 ExecStop=/etc/init.d/nginx stop (code=exited, status=0/SUCCESS)
     Process: 2517 ExecStart=/etc/init.d/nginx start (code=exited, status=7/NOTRUNNING)
      CGroup: name=systemd:/system/nginx.service

So my first question how can I find the reason the problem in this case? How can I find the code line in nginx.conf which prevent it to start successfully?

Next, I have made a little investigation and found this reason. Here is my config:

nginx.conf:

user  nginx;
worker_processes  3;       

events {
    worker_connections  1024;
}

http {
    passenger_root /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.11;
    passenger_ruby /usr/bin/ruby;
    passenger_max_pool_size 2;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    tcp_nopush      on;

    keepalive_timeout  65;
    client_max_body_size 5m;

    gzip  on;

    include sites-enabled/*;    
}

And here is sites-enabled/redmine.conf:

upstream passenger {
           server 127.0.0.1:85; 
}

server {

        listen       80;
        server_name  localhost;
        passenger_enabled on;

        location / {
           root /www/redmine/public;
           if (!-f $request_filename) {
               proxy_pass http://passenger;
               break;
           }
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /srv/www/htdocs/;
        }
}

It doesn't work, but if I'll change last file like this:

server {

        listen       80;
        server_name  localhost;
        passenger_enabled on;

        location / {
           root /www/redmine/public;
           if (!-f $request_filename) {
               proxy_pass http://passenger;
               break;
           }
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /srv/www/htdocs/;
        }
}

upstream passenger {
           server 127.0.0.1:85; 
}

all will work fine (I just move upstream section to the end of file). Why Nginx didn't start with the first configuration file ?

share|improve this question
2  
Did you try following the fine recommendation in the error message you received to "See system logs"? –  womble Jul 22 '12 at 6:20
    
Thanks, it helps me to find the error: duplicate upstream "passenger" in /etc/nginx/sites-enabled/redmine.conf~:27. I have edited file in emacs and it created this file. –  demas Jul 22 '12 at 6:29
    
... and this is why you're not supposed to edit files in sites-enabled directly... –  womble Jul 22 '12 at 6:30
    
Do I need to edit them in another directory and copy them to sites-enabled ? –  demas Jul 22 '12 at 6:38
2  
All site configs should be in sites-available, and then symlinked into sites-enabled when they are to be enabled. –  womble Jul 22 '12 at 7:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.