Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top