1

I have a paster server that is set up to host multiple applications with nginx proxying. For some reason, it appears that requests aren't being sent upstream from nginx. I'm getting 404 errors back in the client, and the only "error" I can find in my logs is the following line from nginx_error.log (being generated approximately once every 5 seconds):

2012/06/12 10:29:37 [info] 22289#0: *49 client closed prematurely connection while reading client request line, client: 192.168.10.135, server: localhost

Some quality time on Google indicates that this isn't an application-breaking issue, but it's all I have to go on right now.

nginx.access.log just prints the following line every 5 seconds:

--[12/Jun/2012:10:31:13 -0400]-4000--

No entry from user actions is being printed to the application log, despite there being several logging messages in the application.

For reference, my nginx.cfg looks like:

daemon             off; 
error_log          /APP_DIRECTORY/logs/nginx_error.log info; 
pid                /APP_DIRECTORy/var/nginx.pid; 
worker_processes   1;  
working_directory  /APP_DIRECTORY/var/;  

events {
  worker_connections 1024; 
}


http {   
  # the three parameters for *_temp_path MUST be here or nginx will not start   
  client_body_temp_path /APP_DIRECTORY/var/lib/nginx/body;   
  proxy_temp_path       /APP_DIRECTORY/var/lib/nginx/proxy;   
  fastcgi_temp_path     /APP_DIRECTORY/var/lib/nginx/fastcgi;   
  include               /etc/nginx/mime.types;   
  default_type          application/octet-stream;  

  log_format            main $http_x_forwarded_for - [$time_local] "$request" $status $body_bytes_sent  "$http_referer" "$http_user_agent";  
  sendfile              on;   
  keepalive_timeout     0;   
  tcp_nodelay           on;  

  gzip                  on;   
  Gzip_proxied          any;   
  gzip_types            text/plain text/html application/json application/xml;

  upstream app_paste {
    server 127.0.0.1:8001;
    #server 127.0.0.1:8002;
    #server 127.0.0.1:8003;
    #server 127.0.0.1:8004;
    #server 127.0.0.1:8005;
    #server 127.0.0.1:8006;
    #server 127.0.0.1:8007;
    #server 127.0.0.1:8008;
    #server 127.0.0.1:8009;
    #server 127.0.0.1:8010;
    #server 127.0.0.1:8011;
    #server 127.0.0.1:8012;   
  }

  server {
    listen 8000;
    server_name localhost;
    access_log /app_DIRECTORY/logs/nginx.access.log main;

    location /crossdomain.xml {
      root /APP_DIRECTORY/www;
    }

    location /v1 {
      proxy_pass http://app_paste;
    }

    location /v2 {
      proxy_pass http://app_paste;
    }   
  } 
}

My application configuration looks like:

[DEFAULT]  
loglevel = INFO  
beaker.session.cookie_expires = true  
beaker.session.lock_dir = .
beaker.session.type = mongodb  
beaker.session.url = mongodb://MONGO_HOST:MONGO_PORT/beaker.sessions?slaveok=true  
beaker.session.skip_pickle = true  

[composite:main]  
use = egg:Paste#urlmap  
/v1/cust1 = cust1  

[app:cust1]  
paste.app_factory = appservice.main:make_app  
company = customer1  
db_host = DB_HOST  
db_port = DB_PORT  
db_name = DB_NAME  
DATA_COLLECTION = customer_data  
USERS_COLLECTION = customer_users  
REPORT_PARAM_1 = REPORT_PARAM_1_DATA  
REPORT_PARAM_2 = REPORT_PARAM_2_DATA  
REPORT_PARAM_3 = REPORT_PARAM_3_DATA  
REPORT_PARAM_4 = REPORT_PARAM_4_DATA  
REPORT_PARAM_5 = REPORT_PARAM_5_DATA  
REPORT_PARAM_6 = REPORT_PARAM_6_DATA  

[server:main]  
use = egg:Paste#http    
host = 0.0.0.0  
port = %(app_port)s

What could be causing this issue? Is there a problem in my configuration?

Anatoly
  • 15,298
  • 5
  • 53
  • 77
Eric Hydrick
  • 3,467
  • 2
  • 28
  • 41
  • what is output of **$ curl http://127.0.0.1:8001**? – Anatoly Jun 13 '12 at 03:34
  • curl 127.0.0.1 gives: Not Found

    Not Found

    The resource could not be found.
    /


    WSGI Server
    – Eric Hydrick Jun 13 '12 at 12:44
  • When I try to access the login service directly via curl 127.0.0.1:8001/v1/app/login (the first service you can get to and where this issue was first seen) I get the correct response. – Eric Hydrick Jun 13 '12 at 12:46
  • first of all, try to simplify the config and get error/access log populated with something - leave only 1 proxy_pass location, bind it to the root location and check all logs – Anatoly Jun 13 '12 at 13:43
  • I've changed the config to just 1 proxy_pass, and set it to "/", but I still can't get any log entries other than what I've posted. – Eric Hydrick Jun 13 '12 at 15:22
  • what is the output for $ nginx -V – Anatoly Jun 14 '12 at 04:57

1 Answers1

0

I changed the way I was processing my configuration files to use arguments passed to my app factory rather than manually parsing the file from the app. For some reason I don't understand at all, this seems to have solved the problem. @mikhailov, thanks for all your time and help.

Eric Hydrick
  • 3,467
  • 2
  • 28
  • 41