[ASTPPCOM-403] 502 bad gateway with ASTPP Created: 16/Apr/18  Updated: 01/Apr/21  Resolved: 01/Apr/21

Status: Done
Project: ASTPP Community
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature
Reporter: waichiu8520 Assignee: Samir Doshi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I am using nginx with 1.12.2 to access ASTPP, but the web browser shows 502 bad gateway. After invetigation, it may relate to nginx buffer config problem.

/etc/nginx/conf.d/cent_astpp.conf

server {
listen 8089 default_server;
listen [::]:8089 default_server;

root /var/www/html/astpp;
client_max_body_size 8M;

  1. Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

server_name _;
access_log /var/log/nginx/astpp_access.log;
error_log /var/log/nginx/astpp_error.log;

location /

{ try_files $uri $uri/ /index.php; }
  1. pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ { fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_split_path_info ^(.+\.php)(/.+)$; # fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; }

    }



 Comments   
Comment by (Community) DN (Inactive) [ 16/Apr/18 ]

Check php-fpm service status

Comment by waichiu8520 [ 16/Apr/18 ]

The php-fpm sevice is running.

[root@localhost log]# service php-fpm status
Redirecting to /bin/systemctl status php-fpm.service
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2018-04-15 23:45:36 EDT; 4min 11s ago
Main PID: 16504 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 10, slow: 0, Traffic: 0req/sec"
CGroup: /system.slice/php-fpm.service
├─16504 php-fpm: master process (/etc/php-fpm.conf)
├─16542 php-fpm: pool www
├─16543 php-fpm: pool www
├─16544 php-fpm: pool www
├─16545 php-fpm: pool www
└─16546 php-fpm: pool www

Apr 15 23:45:36 localhost.localdomain systemd[1]: Starting The PHP FastCGI Process Manager...
Apr 15 23:45:36 localhost.localdomain systemd[1]: Started The PHP FastCGI Process Manager.

Btw, After I check nginx error log.

This shows

2018/04/15 23:46:24 [error] 16536#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.1.137, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "10.10.168.103:8089"
2018/04/15 23:46:24 [error] 16536#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.1.137, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "10.10.168.103:8089", referrer: "http://10.10.168.103:8089/"

Comment by (Community) DN (Inactive) [ 16/Apr/18 ]

Install net-tools and check the response of below command,
netstat -pan|grep 9000
It should be, tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN XXX/php-fpm: master

Generated at Sat Feb 10 07:16:48 CET 2024 using Jira 8.13.3#813003-sha1:22ebedbb75c99b147c66f14e031dd8a2d214753a.