Proxy - 2nd apache process started

mates007 at mates007 at
Thu Apr 2 00:07:52 MSD 2009

Hello nginx users!

I an running nginx/0.6.32 on Debian Lenny as a proxy server for Apache.

I have a script sleep.php which does nothing but sleeps for 120 seconds and then displays phpinfo.

When I call sleep.php bypassing nginx proxy, I can see output after 120 seconds. This is expected.

When I call sleep.php througt proxy, weird things happens:
Apache process is in status Sending Reply for 90 seconds.
In 90th second, another apache process is started, executing sleep.php
In 120th second, 1st process finishes
In 150th second 504 Gateway Time-out is sent to browser
In 210th second, 2nd process finishes

Is there any explanation for this weird behaviour?
Why 2nd process is started?


My nginx configuration:


user  www-data www-data;
worker_processes  1;

events {
        worker_connections  1024;
        use epoll;

http {
        root  /var/www/nginx-default/;
        index index.html;
        error_page   502 503 504  /50x.html;
        error_log /var/log/nginx/error_log;

        server_names_hash_max_size 2048;
        #server_names_hash_bucket_size 128;

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

        sendfile        on;
        tcp_nopush      on;
        tcp_nodelay     on;

        keepalive_timeout 10;

        log_format main
        '$remote_addr - $remote_user [$time_local] '
        '"$request" $status $bytes_sent '
        '"$http_referer" "$http_user_agent" '

        #gzipping all text content
        gzip on;
        gzip_min_length 1100;
        gzip_buffers    4 32k;
        gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
        ignore_invalid_headers  on;

        client_header_timeout       3m;
        client_body_timeout         3m;
        send_timeout                3m;
        connection_pool_size        256;
        client_header_buffer_size   4k;
        large_client_header_buffers 4 32k;
        request_pool_size           4k;
        output_buffers              4 32k;
        postpone_output             1460;

        server {

                location /nginx_status {
                        stub_status on;
                        deny all;

                location /server-status {

                #default proxy settings for each virtual host
                include /etc/nginx/proxy.conf;


        #add fine-tuned virtual hosts
        include /etc/nginx/sites-enabled/*.conf; #see below

                location / {
                  client_max_body_size       10m;
                  client_body_buffer_size    128k;

                  proxy_send_timeout         90;
                  proxy_read_timeout         90;

                  proxy_buffer_size          4k;
                  proxy_buffers              16 32k;
                  proxy_busy_buffers_size    64k;
                  proxy_temp_file_write_size 64k;

                  proxy_connect_timeout      30s;

                  proxy_redirect     off;

                  proxy_set_header   Host             $host;
                  proxy_set_header   X-Real-IP        $remote_addr;
                  proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

One of the sites:

server {

    include /etc/nginx/proxy.conf;

    location ~* ^.+.(jpe?g|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|html?|txt|tar|mid|midi|wav|bmp|rtf|js|swf|avi|mp3)$ {
        #forcing browser to cache locally static content for 30 days
        expires 30d;
        root /home/apache/;

        #graceful fallback in case if static content doesn't exist
        include /etc/nginx/proxy_fallback.conf; #see below

proxy_set_header   Host             $host;
proxy_set_header   X-Real-IP        $remote_addr;
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
if (!-f $request_filename) {

More information about the nginx mailing list