![PHP-FPM을 사용하는 NGINX HTTP 502 - 오류 로그는 없음](https://rvso.com/image/762125/PHP-FPM%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%20NGINX%20HTTP%20502%20-%20%EC%98%A4%EB%A5%98%20%EB%A1%9C%EA%B7%B8%EB%8A%94%20%EC%97%86%EC%9D%8C.png)
나는 문제로 어려움을 겪고 있습니다:
이 Nginx 구성이 있습니다.
# MANAGED BY PUPPET
server {
listen *:80;
server_name www.example.org;
return 301 http://example.org$request_uri;
}
server {
listen *:80;
server_name example.org;
index index.html index.htm index.php;
access_log /var/log/nginx/example.org.access.log combined;
error_log /var/log/nginx/example.org.error.log;
location / {
root /var/www/example_www/htdocs;
index index.html index.htm index.php;
}
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/var/run/php-fpm/example_www-fpm.sock;
include fastcgi.conf;
}
}
# MANAGED BY PUPPET
server {
listen *:443 ssl;
server_name www.example.org;
return 301 https://example.org$request_uri;
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
}
server {
listen *:443 ssl;
server_name example.org;
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
index index.html index.htm index.php;
access_log /var/log/nginx/ssl-example.org.access.log combined;
error_log /var/log/nginx/ssl-example.org.error.log;
location / {
root /var/www/example_www/htdocs;
index index.html index.htm index.php;
}
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/var/run/php-fpm/example_www-fpm.sock;
}
}
fpm 구성은 다음과 같습니다.
[example_www]
; The address on which to accept FastCGI requests.
listen = /var/run/php-fpm/example_www-fpm.sock
; Set listen(2) backlog. A value of '-1' means unlimited.
listen.backlog = -1
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
문제 없이 일부 콘텐츠를 표시하는 파일을 열 수 있습니다 index.html
. 하지만 열면 index.php
HTTP 502가 표시되지만 줄이 /var/log/nginx/ssl-example.org.error.log
없거나/var/log/php/php7.3-fpm
모든 서비스가 작동 중입니다.
● nginx.service - nginx - high performance web server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-01-11 15:13:48 CET; 3min 0s ago
Docs: http://nginx.org/en/docs/
Process: 3720 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 3721 (nginx)
Tasks: 4 (limit: 4580)
Memory: 4.1M
CGroup: /system.slice/nginx.service
├─3721 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
├─3722 nginx: worker process
├─3723 nginx: worker process
└─3724 nginx: worker process
Jan 11 15:13:48 bree systemd[1]: Starting nginx - high performance web server...
Jan 11 15:13:48 bree systemd[1]: Started nginx - high performance web server.
● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-01-11 14:55:30 CET; 21min ago
Docs: man:php-fpm7.3(8)
Process: 3631 ExecReload=/bin/kill -USR2 $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 845 (php-fpm7.3)
Status: "Processes active: 0, idle: 15, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 16 (limit: 4580)
Memory: 45.5M
CGroup: /system.slice/php7.3-fpm.service
├─ 845 php-fpm: master process (/etc/php/7.3/fpm/php-fpm.conf)
├─3632 php-fpm: pool example_www
├─3633 php-fpm: pool example_www
├─3634 php-fpm: pool example_www
├─3635 php-fpm: pool example_www
├─3636 php-fpm: pool example_www
├─3637 php-fpm: pool staging_example_www
├─3638 php-fpm: pool staging_example_www
├─3639 php-fpm: pool staging_example_www
├─3640 php-fpm: pool staging_example_www
├─3641 php-fpm: pool staging_example_www
├─3642 php-fpm: pool www
├─3643 php-fpm: pool www
├─3644 php-fpm: pool www
├─3646 php-fpm: pool www
└─3647 php-fpm: pool www
Jan 11 14:55:29 bree systemd[1]: Starting The PHP 7.3 FastCGI Process Manager...
Jan 11 14:55:30 bree systemd[1]: Started The PHP 7.3 FastCGI Process Manager.
Jan 11 15:13:04 bree systemd[1]: Reloading The PHP 7.3 FastCGI Process Manager.
Jan 11 15:13:04 bree systemd[1]: Reloaded The PHP 7.3 FastCGI Process Manager.