我正努力解决一个问题:
我得到了这个 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.