TransWikia.com

Nginx 502 Bad Gateway Ubuntu 20.04, php 7.4

Ask Ubuntu Asked on December 3, 2021

I have a 502 Bad Gateway on my server, https://sturtz.ml , how do I fix it?

#
# Note: This file must be loaded before other virtual host config files,
#
# HTTP
server {
    # Listen on ipv4
    listen 80;
    
listen   [::]:80 default_server;
    server_name sturtz.ml;
 root /var/www/search;
    index index.php;
    # Redirect all insecure http:// requests to https://
    return 301 https://$host$request_uri;

        location ~ .php$ {
                fastcgi_index index.php;
        }
}
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name sturtz.ml;

    root /var/www/search;
    index index.php;


    ssl_certificate /etc/letsencrypt/live/sturtz.ml/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sturtz.ml/privkey.pem; # managed by Certbot

        location ~ .php$ {

                fastcgi_pass unix:/var/run/php-fpm.sock;
                fastcgi_index index.php;
        }
}



Nginx error log

2020/07/23 00:01:25 [crit] 860#860: *272 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:06:25 [crit] 860#860: *279 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:11:25 [crit] 860#860: *286 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:16:25 [crit] 860#860: *293 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:21:25 [crit] 860#860: *300 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:26:25 [crit] 860#860: *307 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:31:25 [crit] 860#860: *314 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:36:25 [crit] 860#860: *321 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:40:00 [emerg] 4433#4433: "sendfile" directive is duplicate in /etc/nginx/conf-enabled/sendfile.conf:1
2020/07/23 00:40:19 [emerg] 4438#4438: "sendfile" directive is duplicate in /etc/nginx/conf-enabled/sendfile.conf:1
2020/07/23 00:40:55 [emerg] 4443#4443: "sendfile" directive is duplicate in /etc/nginx/conf-enabled/sendfile.conf:1
2020/07/23 00:41:03 [emerg] 4448#4448: "sendfile" directive is duplicate in /etc/nginx/conf-enabled/sendfile.conf:1
2020/07/23 00:41:25 [crit] 860#860: *329 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:41:43 [emerg] 4461#4461: "sendfile" directive is duplicate in /etc/nginx/conf-enabled/sendfile.conf:1
2020/07/23 00:41:51 [emerg] 4462#4462: "sendfile" directive is duplicate in /etc/nginx/conf-enabled/sendfile.conf:1
2020/07/23 00:42:12 [notice] 4470#4470: signal process started
2020/07/23 00:42:19 [crit] 4472#4472: *332 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2604:99c0:8:2f60:1449:6cc9:25bf:dc46, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml"
2020/07/23 00:43:24 [notice] 4478#4478: signal process started
2020/07/23 00:46:25 [crit] 4480#4480: *340 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2607:ff68:107::32, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml", referrer: "https://sturtz.ml"
2020/07/23 00:47:39 [emerg] 4499#4499: a duplicate listen [::]:80 in /etc/nginx/sites-enabled/00-default.conf:10
2020/07/23 00:48:15 [notice] 4511#4511: signal process started
2020/07/23 00:48:17 [crit] 4512#4512: *344 connect() to unix:/var/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2604:99c0:8:2f60:1449:6cc9:25bf:dc46, server: sturtz.ml, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "sturtz.ml"


Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP