php-fpm listen sock 模式

1. touch /dev/shm/php-fpm.sock

   chmod 777 /dev/shm/php-fpm.sock

  chown www:www /dev/shm/php-fpm.sock


2. nginx 配置

     location ~ \.php$ {
                #fastcgi_pass   127.0.0.1:9001;
              
                fastcgi_pass unix:/dev/shm/php-fpm.sock;


                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }


3. php fpm conf 

vim www.conf


;listen = 127.0.0.1:9001
listen = /dev/shm/php-fpm.sock


listen.owner = www
listen.group = www
listen.mode = 0660


4. 问题

connect() to unix:/dev/shm/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.121.130, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/dev/shm/php-fpm.sock:", host: "192.168.121.130"


确保:nginx: worker process 的用户是 www, Permission denied 不是一个用户导致

你可能感兴趣的:(php-fpm listen sock 模式)