A
A
Alexander Pankov2019-08-30 10:40:56
Nginx
Alexander Pankov, 2019-08-30 10:40:56

Why doesn't php-fpm work on nginx on Mac?

Hello.
installed the necessary mysql\nginx\php stack via brew, the screenshot shows at first that everything works.
created virtual host /usr/local/etc/nginx/servers.hello-wrold.conf

server {
    listen 80;
    charset utf-8;
    server_name hello.loc;
    index index.html index.php;
    client_max_body_size 1024m;

    access_log /usr/local/var/log/nginx/hello.loc.access.log;
    error_log /usr/local/var/log/nginx/hello.loc.error.log;

    root /Users/pankovalxndr/Sites/hello-world/code;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }
    location ~ \.php$ {
        if (!-f $request_filename) {
          rewrite  ^(.*)/index.php$  $1/ redirect;
        }
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_send_timeout 21600;
        fastcgi_read_timeout 21600;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location = /favicon.png {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        log_not_found off;
        access_log off;
    }

    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|eot|otf|ttf|woff|woff2)$ {
        log_not_found off;
        access_log off;
        expires 30d;
        add_header Cache-Control public;
    }
}

when I write hello.loc/test.html in the browser, I see my page, everything is fine, but this is understood, because nginx gives statics bypassing the php interpreter, but when I call hello.loc/ (those index.php pages on which I have phpinfo ()), then I get a server response 200 and an empty page, those php does not work, please help me, what am I doing wrong?
here is a screenshot
5d68d278d0521686786882.png
, maybe I'm doing something wrong in /usr/local/etc/php/7.3/php-fpm.d/www.conf
there you need to set permissions, then I put
user = pankovalxndr
group = staff
and get an nginx 502 error
if you do not change anything there
user = _www
group = _www
then an empty page is returned

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Spiridonov, 2019-08-30
@customtema

Show the contents of /usr/local/var/log/nginx/hello.loc.error.log

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question