How to find my php-fpm.sock?

后端 未结 6 1100
长发绾君心
长发绾君心 2020-12-07 21:04

I\'m running Wordpress with: Nginx + PHP-FPM + APC + W3 Total Cache + PageSpeed.

After 3 days researching and configuring, I succeeded to make it work. I configured

6条回答
  •  醉梦人生
    2020-12-07 21:37

    I faced this same issue on CentOS 7 years later

    Posting hoping that it may help others...

    Steps:

    FIRST, configure the php-fpm settings:

    -> systemctl stop php-fpm.service

    -> cd /etc/php-fpm.d

    -> ls -hal (should see a www.conf file)

    -> cp www.conf www.conf.backup (back file up just in case)

    -> vi www.conf

    -> :/listen = (to get to the line we need to change)

    -> i (to enter VI's text insertion mode)

    -> change from listen = 127.0.0.1:9000 TO listen = /var/run/php-fpm/php-fpm.sock

    -> Esc then :/listen.owner (to find it) then i (to change)

    -> UNCOMMENT the listen.owner = nobody AND listen.group = nobody lines

    -> Hit Esc then type :/user = then i

    -> change user = apache TO user = nginx

    -> AND change group = apache TO group = nginx

    -> Hit Esc then :wq (to save and quit)

    -> systemctl start php-fpm.service (now you will have a php-fpm.sock file)

    SECOND, you configure your server {} block in your /etc/nginx/nginx.conf file. Then run:systemctl restart nginx.service

    FINALLY, create a new .php file in your /usr/share/nginx/html directory for your Nginx server to serve up via the internet browser as a test.

    -> vi /usr/share/nginx/html/mytest.php

    -> type o

    -> (PHP page will print date and day in browser)

    -> Hit Esc

    -> type :wq (to save and quite VI editor)

    -> open up a browser and go to: http://yourDomainOrIPAddress/mytest.php (you should see the date and day printed)

提交回复
热议问题