Answer the question
In order to leave comments, you need to log in
Why 502 error when installing php5-fpm + nginx?
I am learning to configure the server manually on VDS. Installed nginx + php5-fpm. I don’t understand why it is necessary to specify 127.0.0.1, and not the address of my server. Although I put the address, nothing happened.
But I can't set it up correctly. Here is the server itself, nginx is running, but the 502 error is 176.112.212.179/index.php
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/htdocs;
index index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT /htdocs;
fastcgi_param SCRIPT_FILENAME /htdocs$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /htdocs$fastcgi_script_name;
include 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_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico)$ {
access_log off;
expires max;
}
location ~ /\.ht {
deny all;
}
}
Answer the question
In order to leave comments, you need to log in
php-fpm usually listens on 127.0.0.1 port 9000, which is what you specify as the backend.
This is done so that it is impossible to access your server as server.ru:9000 and get directly to php-fpm.
For any misunderstandings - see the logs - /var/log/ nginx and php-fpm logs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question