Welcome! Log In Create A New Profile

Advanced

php exits with 502 Bad Gateway

February 18, 2012 09:25PM
Hello

I have a problem where php exits with a 502 Bad Gateway error every once in a while. It appears to be unpredictable. When it happens I have to re-start the vm -- restarting nginx doesn't fix it. The OS is Ubuntu running on VirtualBox and I am connecting to it over a bridged network only from the host Vista machine. This is a portion of the error log and also the configuration. Any help will be appreciated.

2012/02/18 18:12:31 [debug] 723#0: accept on 0.0.0.0:443, ready: 0
2012/02/18 18:12:31 [debug] 723#0: *1031 accept: 192.168.1.69 fd:12
2012/02/18 18:12:31 [debug] 723#0: *1031 event timer add: 12: 60000:2472717397
2012/02/18 18:12:31 [debug] 723#0: *1031 epoll add event: fd:12 op:1 ev:80000001
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_do_handshake: -1
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_get_error: 2
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL handshake handler: 0
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_do_handshake: 1
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL: TLSv1, cipher: "DHE-RSA-AES256-SHA SSLv3 Kx=DH Au=RSA Enc=AES(256) Mac=SHA1"
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_read: -1
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_get_error: 2
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_read: 1
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_read: 346
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_read: -1
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_get_error: 2
2012/02/18 18:12:31 [debug] 723#0: *1031 event timer del: 12: 2472717397
2012/02/18 18:12:31 [debug] 723#0: *1031 epoll add event: fd:12 op:3 ev:80000005
2012/02/18 18:12:31 [debug] 723#0: *1031 socket 13
2012/02/18 18:12:31 [debug] 723#0: *1031 epoll add connection: fd:13 ev:80000005
2012/02/18 18:12:31 [debug] 723#0: *1031 connect to 127.0.0.1:9000, fd:13 #1032
2012/02/18 18:12:31 [debug] 723#0: *1031 event timer add: 13: 60000:2472717424
2012/02/18 18:12:31 [error] 723#0: *1031 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.69, server: 192.168.1.68, request: "GET /pcode/register.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.68"
2012/02/18 18:12:31 [debug] 723#0: *1031 event timer del: 13: 2472717424
2012/02/18 18:12:31 [debug] 723#0: *1031 write new buf t:1 f:0 099429A4, pos 099429A4, size: 157 file: 0, size: 0
2012/02/18 18:12:31 [debug] 723#0: *1031 write old buf t:1 f:0 099429A4, pos 099429A4, size: 157 file: 0, size: 0
2012/02/18 18:12:31 [debug] 723#0: *1031 write new buf t:0 f:0 00000000, pos 080E7600, size: 120 file: 0, size: 0
2012/02/18 18:12:31 [debug] 723#0: *1031 write new buf t:0 f:0 00000000, pos 080E6460, size: 53 file: 0, size: 0
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL buf copy: 157
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL buf copy: 120
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL buf copy: 53
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL to write: 330
2012/02/18 18:12:31 [debug] 723#0: *1031 SSL_write: 330
2012/02/18 18:12:31 [debug] 723#0: *1031 event timer add: 12: 75000:2472732425


... and nginx.conf

user root;
worker_processes 4;

events {

}


http {
index index.php;
include /etc/nginx/mime.types;
default_type application/octet-stream;

server {
listen 80;

location ~* /pcode/(register|loginout).php {
rewrite ^ https://$host$uri permanent;
}

include /etc/nginx/server_params;

}

server {
listen 443 ssl;
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;

include /etc/nginx/server_params;
}
}

...the include file server_params being called:

server_name 192.168.1.68;
root /usr/share/nginx/www;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug_event;

location / {
try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param HTTPS on;
}

location @rewrites{
rewrite ^ /index.php last;
}


#catch static file requests
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

#prevent hidden file requests --starting with a period

location ~ /\. {
access_log off; log_not_found off; deny all;
}
Subject Author Posted

php exits with 502 Bad Gateway

mfouwaaz February 18, 2012 09:25PM

Re: php exits with 502 Bad Gateway

fbhosted February 19, 2012 11:22AM

Re: php exits with 502 Bad Gateway

fbhosted February 19, 2012 11:22AM

Re: php exits with 502 Bad Gateway

mfouwaaz February 19, 2012 02:05PM

Re: php exits with 502 Bad Gateway

mfouwaaz February 19, 2012 03:37PM

Re: php exits with 502 Bad Gateway

fbhosted February 19, 2012 02:12PM

Re: php exits with 502 Bad Gateway

mfouwaaz February 19, 2012 02:18PM

Re: php exits with 502 Bad Gateway

fbhosted February 19, 2012 02:48PM

Re: php exits with 502 Bad Gateway

Edho Arief February 19, 2012 08:34PM

Re: php exits with 502 Bad Gateway

mfouwaaz February 21, 2012 11:23PM

Re: php exits with 502 Bad Gateway

fbhosted February 22, 2012 01:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 301
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready