Answer the question
In order to leave comments, you need to log in
Debian 9 + nginx + php-fpm what's the problem?
Tell me what could be the problem:
Debian 9.0 is installed on the cloud
1. Installed according to the instructions for PHP 7 ( https://github.com/kasparsd/php-7-debian)
2. Installed according to the instructions for Nginx 1.13.5 ( https:// gist.github.com/tollmanz/8662688)
The problem is that php files do not work, writes 502 Bad Gateway. The site on pure html works.
Initially, the php7-fpm.sock file was not created. I created it manually:
python -c "import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('/run/php7-fpm.sock')"
[www]
user = www-data
group = www-data
listen = /run/php7-fpm.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
user www-data;
worker_processes 4;
worker_rlimit_nofile 200000;
pid /var/run/nginx.pid;
events {
worker_connections 4000;
use epoll;
multi_accept on;
}
http {
charset utf-8;
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 30;
keepalive_requests 1000;
reset_timedout_connection on;
client_body_timeout 10;
send_timeout 2;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
error_log /var/log/nginx/error.log crit; #логирование только крит. ошибок
gzip on;
gzip_disable "msie6";
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
include /etc/nginx/sites-enabled/*;
upstream php7-fpm-sock {
server unix:/run/php7-fpm.sock;
}
}
server {
listen 80;
charset utf-8;
server_name test.com test.com;
root /var/www/test.com;
index index.php;
location ~ /\. {
deny all;
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_pass php7-fpm-sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www;
# send bad requests to 404
fastcgi_intercept_errors on;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
1. Installed according to PHP 7 instructions ( https://github.com/kasparsd/php-7-debian)
Why is upstream called - php7-fpm-sock , but connected as fastcgi_pass php; ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question