N
N
Nurlan2015-07-03 13:07:58
PHP
Nurlan, 2015-07-03 13:07:58

Why don't Nginx+PHP-FPM work after aptitude upgrade?

I have a server to learn how to administer a little on it. I didn’t go there for two months and decided to do aptitude upgrade yesterday because of nothing to do. After that, the hosts no longer work, I did not find anything in the nginx, php and syslog logs. If the php service is stopped, then nginx issues 502.
nginx - 1.8
php-fpm - 5.6
nginx config:

server{
        listen   80;
        server_name telesovet.litravechera.ru;
        root /var/www/telesovet;
        index index.php;

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
                include fastcgi_params;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
        }
}

In PHP5, www.conf listen is 127.0.0.1:9000. I did it through the socket and changed the nginx config, but I did not achieve anything.
drwxrwxrwx 2 root root 4096 Jul 3 12:12 telesovet
-rwxrwxrwx 1 root root 131 Jul 3 11:30 index.php
-rw-r--r-- 1 root root 7 Jul 3 12:12 test.txt
When requesting test. txt is given away.
Please tell me I don't have any ideas.
PS I ask a question with the hope of either an answer, or a magical event, when everything starts working by itself, you just have to ask.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Nurlan, 2015-07-03
@daager

Found what the problem is. Thanks everyone for the replies. The problem turned out to be in the nginx config, or rather, in the listen parameter.
Extract from documentation:
There were other configs, and they just have "listen ip: port" and it turns out that listen is more important than an exact match with server_name. So you need to be careful, and don't use listen just like that.
Thanks again.
PS Although it's still strange why everything broke after the update.

A
Adamos, 2015-07-03
@Adamos

- include fastcgi_params
+ include fastcgi.conf

D
dvachek, 2015-07-03
@dvachek

In nginx 1.8, some directive has become mandatory for specifying in the location block that sends a request to php, but I don’t remember which one, just look at the config examples specifically for 1.8.

M
Mikhail Osher, 2015-07-03
@miraage

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question