502 Bad Gateway на Nginx с Laravel, PHP 8.3 и Ubuntu 24.04Php

Кемеровские программисты php общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 502 Bad Gateway на Nginx с Laravel, PHP 8.3 и Ubuntu 24.04

Сообщение Anonymous »

Я установил Nginx 1.24.0 в Ubuntu 24.04 LTS, установил PHP 8.3 (PHP 8.3.6) и развернул новый проект Laravel 11.2. Я создал виртуальный хост на порту 82 для telegrambot.test. Однако когда я пытаюсь получить доступ к http://telegrambot.test:82, я получаю ошибку 502 Bad Gateway.
Вот моя конфигурация Nginx (nginx.conf):

Код: Выделить всё

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;

server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
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;

##
# 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/*;
}

#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1"  & q u o t ; U I D P L U S & q u o t ; ; < b r   / > # < b r   / > #       s e r v e r   { < b r   / > #               l i s t e n           l o c a l h o s t : 1 1 0 ; < b r   / > #               p r o t o c o l       p o p 3 ; < b r   / > #               p r o x y             o n ; < b r   / > #       } < b r   / > # < b r   / > #       s e r v e r   { < b r   / > #               l i s t e n           l o c a l h o s t : 1 4 3 ; < b r   / > #               p r o t o c o l       i m a p ; < b r   / > #               p r o x y             o n ; < b r   / > #       } < b r   / > # } < b r   / > < b r   / > #   c o n f i g u r a t i o n   f i l e   / e t c / n g i n x / m i m e . t y p e s : < b r   / > < b r   / > t y p e s   { < b r   / >         t e x t / h t m l                                                                                 h t m l   h t m   s h t m l ; < b r   / >         t e x t / c s s                                                                                   c s s ; < b r   / >         t e x t / x m l                                                                                   x m l ; < b r   / >         i m a g e / g i f                                                                                 g i f ; < b r   / >         i m a g e / j p e g                                                                               j p e g   j p g ; < b r   / >         a p p l i c a t i o n / j a v a s c r i p t                                                       j s ; < b r   / >         a p p l i c a t i o n / a t o m + x m l                                                           a t o m ; < b r   / >         a p p l i c a t i o n / r s s + x m l                                                             r s s ; < b r   / > < b r   / >         t e x t / m a t h m l                                                                             m m l ; < b r   / >         t e x t / p l a i n                                                                               t x t ; < b r   / >         t e x t / v n d . s u n . j 2 m e . a p p - d e s c r i p t o r                                   j a d ; < b r   / >         t e x t / v n d . w a p . w m l                                                                   w m l ; < b r   / >         t e x t / x - c o m p o n e n t                                                                   h t c ; < b r   / > < b r   / >         i m a g e / a v i f                                                                               a v i f ; < b r   / >         i m a g e / p n g                                                                                 p n g ; < b r   / >         i m a g e / s v g + x m l                                                                         s v g   s v g z ; < b r   / >         i m a g e / t i f f                                                                               t i f   t i f f ; < b r   / >         i m a g e / v n d . w a p . w b m p                                                               w b m p ; < b r   / >         i m a g e / w e b p                                                                               w e b p ; < b r   / >         i m a g e /x-icon                                     ico;
image/x-jng                                      jng;
image/x-ms-bmp                                   bmp;

font/woff                                        woff;
font/woff2                                       woff2;

application/java-archive                         jar war ear;
application/json                                 json;
application/mac-binhex40                         hqx;
application/msword                               doc;
application/pdf                                  pdf;
application/postscript                           ps eps ai;
application/rtf                                  rtf;
application/vnd.apple.mpegurl                    m3u8;
application/vnd.google-earth.kml+xml             kml;
application/vnd.google-earth.kmz                 kmz;
application/vnd.ms-excel                         xls;
application/vnd.ms-fontobject                    eot;
application/vnd.ms-powerpoint                    ppt;
application/vnd.oasis.opendocument.graphics      odg;
application/vnd.oasis.opendocument.presentation  odp;
application/vnd.oasis.opendocument.spreadsheet   ods;
application/vnd.oasis.opendocument.text          odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc                         wmlc;
application/wasm                                 wasm;
application/x-7z-compressed                      7z;
application/x-cocoa                              cco;
application/x-java-archive-diff                  jardiff;
application/x-java-jnlp-file                     jnlp;
application/x-makeself                           run;
application/x-perl                               pl pm;
application/x-pilot                              prc pdb;
application/x-rar-compressed                     rar;
application/x-redhat-package-manager             rpm;
application/x-sea                                sea;
application/x-shockwave-flash                    swf;
application/x-stuffit                            sit;
application/x-tcl                                tcl tk;
application/x-x509-ca-cert                       der pem crt;
application/x-xpinstall                          xpi;
application/xhtml+xml                            xhtml;
application/xspf+xml                             xspf;
application/zip                                  zip;

application/octet-stream                         bin exe dll;
application/octet-stream                         deb;
application/octet-stream                         dmg;
application/octet-stream                         iso img;
application/octet-stream                         msi msp msm;

audio/midi                                       mid midi kar;
audio/mpeg                                       mp3;
audio/ogg                                        ogg;
audio/x-m4a                                      m4a;
audio/x-realaudio                                ra;

video/3gpp                                       3gpp 3gp;
video/mp2t                                       ts;
video/mp4                                        mp4;
video/mpeg                                       mpeg mpg;
video/ogg                                        ogv;
video/quicktime                                  mov;
video/webm                                       webm;
video/x-flv                                      flv;
video/x-m4v                                      m4v;
video/x-matroska                                 mkv;
video/x-mng                                      mng;
video/x-ms-asf                                   asx asf;
video/x-ms-wmv                                   wmv;
video/x-msvideo                                  avi;
}

# Default server configuration
#
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;

root /var/www/html;

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

server_name _;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}

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

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

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

# configuration file /etc/nginx/fastcgi.conf:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  REMOTE_USER        $remote_user;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

# configuration file /etc/nginx/sites-enabled/telegrambot:
server {
listen 82;
listen [::]:82;

server_name telegrambot.test;

root /var/www/telegrambot/public;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php index.nginx-debian.html;

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

charset utf-8;

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; log_not_found off;  }

error_page 404 /index.php;

location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}
}

# configuration file /etc/nginx/fastcgi_params:

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  REMOTE_USER        $remote_user;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

# configuration file /etc/nginx/sites-enabled/tutorial:
server {
listen 81;
listen [::]:81;

server_name example.ubuntu.com;

root /var/www/tutorial;
index index.html;

location / {
try_files $uri $uri/ =404;
}
}
Мой файл /etc/hosts настроен следующим образом:

Код: Выделить всё

127.0.0.1       localhost
127.0.1.1       Amyr-Linux
127.0.0.1       telegrambot.test

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Я установил новое приложение Laravel в /var/www/telegrambot и установил общую папку в качестве корня документа. Я ожидал, что смогу получить доступ к приложению Laravel, посетив http://telegrambot.test:82, но вместо этого получил ошибку 502 Bad Gateway.
Мой /var/log/ вывод nginx/error.log:

Код: Выделить всё

2024/09/24 21:00:35 [error] 58482#58482: *4 open() "/home/amyr/Desktop/Sites/telbot/public/favicon.ico" failed (13: Permission denied), client: 127.0.0.1, server: telegrambot, request: "GET /favicon.ico HTTP/1.1", host: "telegrambot:82", referrer: "http://telegrambot:82/"
2024/09/24 21:00:37 [error] 58485#58485: *5 directory index of "/var/www/telbot/public/" is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "127.0.0.1:85"
2024/09/24 21:14:24 [error] 61674#61674: *2 directory index of "/var/www/telbot/public/" is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "telbot:85"
2024/09/24 21:20:52 [error] 61673#61673: *3 directory index of "/var/www/telbot/public/" is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "telbot:85"
2024/09/24 21:44:11 [error] 71158#71158: *2 directory index of "/var/www/telbot/public/"  is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "telbot:85"
2024/09/24 22:26:27 [crit] 83369#83369: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:15 [crit] 84798#84798: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:19 [crit] 84799#84799: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:20 [crit] 84801#84801: *5 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:20 [crit] 84800#84800: *7 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:32:35 [crit] 84803#84803: *9 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:32:36 [crit] 84804#84804: *11 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:33:03 [crit] 84804#84804: *11 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:25:47 [crit] 84805#84805: *14 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:26:11 [crit] 90146#90146: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:27:14 [crit] 90436#90436: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:27:40 [crit] 90623#90623: *2 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/24 23:35:20 [crit] 93355#93355: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/24 23:35:21 [crit] 93356#93356: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host:  "telegrambot.test"
2024/09/24 23:35:58 [crit] 93614#93614: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:01:58 [crit] 107195#107195: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:01:59 [crit] 107196#107196: *5 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:02:33 [crit] 107197#107197: *7 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:02:35 [crit] 107198#107198: *9 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:06:52 [crit] 107199#107199: *11 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:16:07 [crit] 112771#112771: *1 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:17:09 [crit] 113375#113375: *2 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:17:11 [crit] 113378#113378: *4 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:48:35 [crit] 121423#121423: *1 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:48:37 [crit] 121424#121424: *3 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:57:44 [crit] 121427#121427: *5 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:02:05 [crit] 2658#2658: *1 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:02:35 [crit] 2660#2660: *3 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:02:37 [crit] 2661#2661: *5 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2:  No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:03:06 [crit] 2659#2659: *7 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "telegrambot.test:82"
2024/09/25 11:20:33 [crit] 2854#2854: *4 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "telegrambot.test:82"
Проверив свою конфигурацию, я заметил, что директива fastcgi_pass в моей конфигурации Nginx указывает на сокет FPM PHP 7.4, хотя я использую PHP 8.3. Я думаю, что это может быть основной причиной проблемы.
Я выполнил следующую команду, чтобы проверить правильный сокет PHP 8.3 FPM:

Код: Выделить всё

sudo find /var/run/php/ -name "php8.3-fpm.sock"
В зависимости от результата я обновил свою конфигурацию Nginx до:

Код: Выделить всё

fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
Однако проблема остается, и я все еще получаю сообщение об ошибке 502 Bad Gateway. Я также подтвердил, что службы Nginx и PHP-FPM работают правильно.
Я попробовал простой PHP-скрипт (phpinfo()), и он работает отлично
Я ожидаю, что Laravel загрузится правильно при доступе к http://telegrambot.test:82, но вместо этого я продолжаю получать эту ошибку шлюза. Есть какие-нибудь предложения о том, что еще мне следует проверить или настроить?

Подробнее здесь: https://stackoverflow.com/questions/790 ... untu-24-04
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • 502 Bad Gateway nginx/1.27.3 Laravel Herd PHP 8.2 macOS Sonoma
    Anonymous » » в форуме Php
    0 Ответы
    65 Просмотры
    Последнее сообщение Anonymous
  • 502 Bad Gateway nginx/1.27.3 Laravel Herd PHP 8.2 macOS Sonoma
    Anonymous » » в форуме Php
    0 Ответы
    45 Просмотры
    Последнее сообщение Anonymous
  • Spring Cloud Gateway MVC с Spring Boot 3.2.4 Возврат 502 Bad Gateway после развертывания (работая с Zuul)
    Anonymous » » в форуме JAVA
    0 Ответы
    22 Просмотры
    Последнее сообщение Anonymous
  • Сервер Express 502 Bad Gateway с неправильной маршрутизацией NGINX
    Anonymous » » в форуме Linux
    0 Ответы
    43 Просмотры
    Последнее сообщение Anonymous
  • Как исправить ошибку 502 Bad Gateway NGINX при развертывании приложения django в командной строке AWSEB?
    Гость » » в форуме Python
    0 Ответы
    47 Просмотры
    Последнее сообщение Гость

Вернуться в «Php»