Home  >  Q&A  >  body text

nginx and php-fpm socket owner permission issues

After configuring ngix php-fpm nginx Error:

2014/12/08 12:19:19 [crit] 27575#0: *4 connect() to unix:/var/run/php-fpm/vbox.dev.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.56.101, server: vbox.dev, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/vbox.dev.sock:", host: "vbox.dev"

The relevant configuration is as follows:

php-fpm

[vbox.dev]

user = nginx
group = nginx

listen = /var/run/php-fpm/vbox.dev.sock

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

pm = dynamic
pm.max_children = 75
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

File Permissions:

ls -al /var/run/php-fpm/vbox.dev.sock 
srw-rw----. 1 nginx nginx 0 Dec  8 12:19 /var/run/php-fpm/vbox.dev.sock

ps -ef | grep nginx:
root     27573     1  0 12:17 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx    27575 27573  0 12:17 ?        00:00:00 nginx: worker process

ps -ef | grep php-fpm
root     27587     1  0 12:19 ?        00:00:00 php-fpm: master process (/etc/php-fpm.conf)                                                  
nginx    27588 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27589 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27590 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27591 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27592 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27593 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27594 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27595 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27596 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27597 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
www-data 27598 27587  0 12:19 ?        00:00:00 php-fpm: pool global-pool

Please give me some advice!

怪我咯怪我咯2712 days ago749

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 17:28:02

    listen.owner = nginx
    listen.group = nginx
    listen.mode = 0660

    The above listen.owner listen.group does not need to be set
    listen.mode = 0666

    It is also recommended that the sock file be placed in the /dev/shm directory
    Put the sock file in the memory in this directory to help improve performance

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:28:02

    Permission denied...

    You don’t have permission!

    Executed under root.

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-16 17:28:02

    Have you solved the problem? If not, can you let me check the permissions of your /var/run/php-fpm directory

    reply
    0
  • Cancelreply