duanqiaoren9975 2017-09-11 13:34
浏览 96

在centos 7.3上的php`connect()failed`

I am deploying a php project on centos 7.3 , there is an error connect() failed .

nginx and php and mariadb has been running,and I can access the welcome page of nginx.

[root@demo ~]# systemctl list-unit-files --type=service | grep enabled
//...
mariadb.service                               enabled 
mysql.service                                 enabled 
mysqld.service                                enabled 
nginx.service                                 enabled 
php-fpm.service                               enabled 
//...

Then,I upload a php project to this centos server.

nginx configuration is like this: /etc/nginx/conf.d/default.conf

location ~ \.php$ {
    root           /var/www/project/public;
    #fastcgi_pass   unix:/run/php-fpm.sock;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

php configuration is like this: /etc/php-fpm.d/www.conf

#listen = /run/php-fpm.sock
listen = 127.0.0.1:9000

error in /var/log/nginx/error.log

//error of using `unix:/run/php-fpm.sock`:
connect() to unix:/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, upstream: "fastcgi://unix:/run/php-fpm.sock:"

//error of `using 127.0.0.1:9000`:
connect() failed (111: Connection refused) while connecting to upstream, upstream: "fastcgi://127.0.0.1:9000"

What should I do?

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 运筹学中在线排序的时间在线排序的在线LPT算法
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试,帮帮忙吧