无法为地址php-fpm绑定监听套接字

前端之家收集整理的这篇文章主要介绍了无法为地址php-fpm绑定监听套接字 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我逐步遵循了https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7的说明,但是当我重新启动PHP-fpm时,它失败了.

错误日志:

Error: unable to bind listening socket for address ‘var/run/PHP-fpm.d/www.conf’ : no such file or directory
Error: FPM initialization Failed

环境:VirtualBox中安装了装有PHP,MariaDB和Nginx的CentOS 7.

日志/报告:

journalctl显示

    localhost.localdomain PHP-fpm[2574]: Error: unable to bind listening socket for address '/var/run/PHP-fpm.d/www.conf' : No such file or directory
    localhost.localdomain PHP-fpm[2574]:Error: FPM initialization Failed
    localhost.localdomain systemd[1]: PHP-fpm.service: main process exited,code=exited,status=78/n/a
    localhost.localdomain systemd[1]: Failed to start the PHP fastCGI process manager.

状态显示

    PHP-fpm.service - the PHP fastcgi process manager
    Loaded: loaded (/usr/lib/systemd/system/PHP-fpm.service; disabled)
    Active: Failed (result: exit-cod )
    Process: 2639 ExecStart=/usr/sbin/PHP-fpm --nodaemonize (code=exited,status=78)
    Main PID:2639 (code=exited,status=78)
    localhost.localdomain PHP-fpm[2639]: Error: unable to bind listening socket for address '/var/run/PHP-fpm.d/www.conf' : No such file or directory
    localhost.localdomain PHP-fpm[2639]: ERROR: FPM initialization Failed
    localhost.localdomain steam[1]: Failed to start the PHP fastCGI process manager.
    localhost.localdomain steam[1]: Unit PHP-fpm.service entered Failed state.

www.conf是

    [www]
    listen = /var/run/PHP-fpm.d/www.conf
    listen.allowed_clients = 127.0.0.1
    user = apache
    group = apache
    pm = dynamic
    pm.max_children = 50
    pm.start_servers = 5
    pm.min_spare_servers = 5
    pm.max_spare_servers = 5
    slowlog = /var/log/PHP-fpm/www-slow.log
    PHP_admin_value[error_log] = /var/log/PHP-fpm/www-error.log
    PHP_admin_flag[log_errors] = on
    PHP_value[session.save_handler] = files
    PHP_value[session.save_path] = /var/lib/PHP/session

Nginx default.conf是

    server{
            listen 80;
            server_name ip address;
            root /usr/share/Nginx/html;
            location / {
            try_files $uri $uri/ = 404;
    }
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/Nginx/html;
    }
    location ~\.PHP${
            fastcgi_split_path_info ^(.+?\.PHP)(./*)$;
            fastcgi_pass unix:/var/run/PHP-fpm.sock;
            fastcgi_index index.PHP;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }

并且,检查cgi.fix_pathinfo = 0.

最佳答案
为sock文件创建目录:

mkdir -p /var/run/

猜你在找的Nginx相关文章