1

我有一个粘贴服务器,它设置为使用 nginx 代理托管多个应用程序。出于某种原因,似乎没有从 nginx 向上游发送请求。我在客户端收到 404 错误,我可以在日志中找到的唯一“错误”是 nginx_error.log 中的以下行(大约每 5 秒生成一次):

2012/06/12 10:29:37 [info] 22289#0: *49 客户端在读取客户端请求行时提前关闭连接,客户端:192.168.10.135,服务器:本地主机

Google 上的一些优质时间表明这不是一个破坏应用程序的问题,但这是我现在必须继续进行的全部内容。

nginx.access.log 每 5 秒打印一次以下行:

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

尽管应用程序中有几条日志消息,但没有将用户操作的条目打印到应用程序日志中。

作为参考,我的 nginx.cfg 看起来像:

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;
    }   
  } 
}

我的应用程序配置如下所示:

[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

什么可能导致此问题?我的配置有问题吗?

4

1 回答 1

0

我更改了处理配置文件的方式,以使用传递给我的应用程序工厂的参数,而不是从应用程序手动解析文件。由于某种原因,我根本不明白,这似乎已经解决了问题。@mikhailov,感谢您的所有时间和帮助。

于 2012-06-14T13:05:57.937 回答