Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Ошибка 502 при обращении к некоторым страницам
 
 
Здравствуйте! При обращении к урл http://admins.biz.ua/test2/ или к некоторым 
поддоменам возникает ошибка 502. Апач стоит в бекенде а nginx слушает порт 81. 
Стыковал их при помощи iptables редиректом всех запросов на 81 порт. Вот конфиг 
енжинкса:
user  apache apache;
worker_processes  4;   # how many processors or how many hard disks you have
error_log  /var/log/nginx/error.log;
events {
    worker_connections 16384;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  75 20;
    gzip  on;
    server_names_hash_bucket_size 64;
    reset_timedout_connection on;
     client_max_body_size 100m;
#------------------
#fullproxy for all
    server {
    listen       87.118.126.40:81 default rcvbuf=8192 sndbuf=16384 
backlog=32000                                             ;
        server_name  profhost.biz.ua ;     # "_" is for handle all hosts that 
ar                                             e not described by server_name
        charset off;
        access_log     on;
login as: root
root@xxxxxxxxxxxxx's password:
Last login: Sat Jul 11 12:26:02 2009 from 195.234.61.36
[root@profhost ~]# cat /usr/local/nginx/conf/nginx.conf
# /usr/local/nginx/conf/nginx.conf
user  apache apache;
worker_processes  4;   # how many processors or how many hard disks you have
error_log  /var/log/nginx/error.log;
events {
    worker_connections 16384;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  75 20;
    gzip  on;
    server_names_hash_bucket_size 64;
    reset_timedout_connection on;
     client_max_body_size 100m;
#------------------
#fullproxy for all
    server {
    listen       87.118.126.40:81 default rcvbuf=8192 sndbuf=16384 
backlog=32000                                             ;
        server_name  profhost.biz.ua ;     # "_" is for handle all hosts that 
ar                                             e not described by server_name
        charset off;
        access_log     on;
        access_log /var/log/nginx/access.log  main;
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /var/www/html/;
        }
        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass              http://87.118.126.40;    # apache here
                client_max_body_size       16m;
                client_body_buffer_size    128k;
                proxy_buffering     off;
                #proxy_buffering     on;
                proxy_connect_timeout      90;
                proxy_send_timeout         90;
                proxy_read_timeout         120;
               proxy_buffer_size          8k;
               proxy_buffers              32 32k;
               proxy_busy_buffers_size    64k;
               proxy_temp_file_write_size 64k;
                error_page              502 503
/usr/local/www/nginx-dist/50x.html;
        }
        location /nginx_status {
            stub_status on;
            access_log   off;
            allow 87.118.126.40;
            allow 87.118.127.40;
            allow 127.0.0.1;
            deny all;
    }
}
В логах апача пусто, а вот в логах енжинкса такая строка:
2009/07/12 15:30:09 [error] 2441#0: *438485 upstream prematurely closed 
connection while reading response header from upstream, client: 66.249.71.240, 
server: profhost.biz.ua, request: "GET /test2/ HTTP/1.1", upstream: 
"http://87.118.126.40:80/test2/", host: "admins.biz.ua"
Подскажите пожалуйста как решить проблему. Спасибо.
 
 |