Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php7.4-fpm + Phalcon4.1 with 502 Bad Gateway Error! #15210

Closed
xaero7 opened this issue Nov 14, 2020 · 4 comments
Closed

php7.4-fpm + Phalcon4.1 with 502 Bad Gateway Error! #15210

xaero7 opened this issue Nov 14, 2020 · 4 comments
Labels
duplicate Duplicate issue. The duplicate issue is referenced in the comments

Comments

@xaero7
Copy link

xaero7 commented Nov 14, 2020

Server information:

  • nginx: 1.18.0 + php7.4-fpm
  • PHP 7.4.3
  • Phalcon 4.1
  • Ubuntu 20.04 LTS 64bit

I install the extension in the way apt-get install php7.4-phalcon

PHP + ngnix works well, because I can CURD with phpmysqladmin .

When running the basic tutorial: https://github.com/phalcon/tutorial/tree/4.0.x

It got errors:

2020/11/13 22:18:02 [error] 15276#15276: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.10.123, server: svr, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "10.0.10.1"
2020/11/13 22:18:04 [error] 15276#15276: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.10.123, server: svr, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "10.0.10.1"
2020/11/13 22:29:25 [error] 15372#15372: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.10.123, server: svr, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "10.0.10.1"
2020/11/13 22:29:26 [error] 15372#15372: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.10.123, server: svr, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "10.0.10.1"
2020/11/13 22:29:27 [error] 15372#15372: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.10.123, server: svr, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "10.0.10.1"
2020/11/13 22:29:56 [alert] 15372#15372: *2 open socket #14 left in connection 4
2020/11/13 22:29:56 [alert] 15372#15372: aborting
2020/11/13 22:31:17 [error] 672#672: *2 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.10.123, server: svr, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "10.0.10.1"

ngnix.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 120;
    types_hash_max_size 2048;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;

    client_max_body_size    32m;

    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

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

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

default site conf


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

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    server_name svr;

    root /var/www/html/public;

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

    charset utf-8;
    client_max_body_size 32M;
    fastcgi_read_timeout 300;

    location / {        
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        # try_files $uri $uri/ =404;
        # Matches URLS `$_GET['_url']`
        try_files $uri $uri/ /index.php?_url=$uri&$args;
    }

    # pass PHP scripts to FastCGI server
    #
    #location ~ \.php {
    #   include snippets/fastcgi-php.conf;

    #   # With php-fpm (or other unix sockets):
    #   fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    #   # With php-cgi (or other tcp sockets):
    #   fastcgi_pass 127.0.0.1:9000;
    #}

    # When the HTTP request does not match the above
    # and the file ends in .php
    location ~ [^/]\.php(/|$) {
        # try_files $uri =404;

        # Ubuntu and PHP7.0-fpm in socket mode
        # This path is dependent on the version of PHP install
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

        # Alternatively you use PHP-FPM in TCP mode (Required on Windows)
        # You will need to configure FPM to listen on a standard port
        # https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/
        # fastcgi_pass  127.0.0.1:9000;

        fastcgi_index /index.php;

        include fastcgi_params;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }

        fastcgi_param PATH_INFO       $fastcgi_path_info;
        # fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        # and set php.ini cgi.fix_pathinfo=0

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires       max;
        log_not_found off;
        access_log    off;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }
}
@rudiservo
Copy link
Contributor

rudiservo commented Nov 14, 2020

Check if you have PHP errors enabled, also check if you have FPM running and restart services.

@xaero7
Copy link
Author

xaero7 commented Nov 15, 2020

Well, after long day's trying, I reinstall the Phalcon manually according to the issue #15107 (comment)

and , it works!

What's the problem?

@rudiservo
Copy link
Contributor

rudiservo commented Nov 15, 2020

@xaero7 Probably the phalcon package in the repository is broken and needs to be updated.
You are using the packagecloud.io repository correct?

@ruudboon I would mark this duplicate of #15107

@Jeckerson Jeckerson added the duplicate Duplicate issue. The duplicate issue is referenced in the comments label Nov 20, 2020
@Jeckerson
Copy link
Member

Closed in favor #15107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Duplicate issue. The duplicate issue is referenced in the comments
Projects
None yet
Development

No branches or pull requests

3 participants