Why the 502 error when installing php5-fpm + nginx?

Learn to configure the server manually on VPS. Installed nginx + php5-fpm. I do not understand why it is necessary to specify, not the address of my server. Although put the address, nothing came of it.

But unable to configure it correctly. Here is the server nginx running, but 502 error -

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_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;
 set by the fastcgi_buffer_size 128k;
 fastcgi_buffers directives 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;


What's the problem?
July 8th 19 at 11:16
1 answer
July 8th 19 at 11:18
php-fpm usually listens to the address and port 9000, it's what you point out as the backend.
This is done so you can't access your server as server.EN:9000 and to get directly to php-fpm.
In all neponyatkah - see the logs - /var/log/ logs of nginx and php-fpm
That is, even if I have VPS , I still have to specify ? - Mohamed.Funk commented on July 8th 19 at 11:21
If you have VDS installed nginx and php-fpm, then the answer is Yes.
If nginx is installed on the same vds, and php-fpm on the other - no. - Daphne_Roob commented on July 8th 19 at 11:24
Just in case I will explain - - this is not "some Internet address" is "localhost", that is "the same computer". - Daphne_Roob commented on July 8th 19 at 11:27
: all I knew) I solved the problem by installing php listen =; Thank you) - Mohamed.Funk commented on July 8th 19 at 11:30

Find more questions by tags PHPNginx