nginx,lua,shell执行服务器脚本问题connect() to unix:/tmp/shell.sock failed (2: No such file or directory)

nginx,lua,shell执行服务器脚本问题connect to unix:/tmp/shell.sock failed 2: No such file or directory

参考文档:

https://www.code404.icu/830.html

shell.sock找不到的解决办法

connect() to unix:/tmp/shell.sock failed (2: No such file or directory)
按照参考文档中的来做的话,shell.sock被放到了/tmp目录下,但是使用过程中,一直报文件找不到。
解决办法是将shell.sock放到其他目录

connect() to unix:/tmp/shell.sock failed (2: No such file or directory)

例如:

./sockproc /data/shell.sock
chmod 0666 /data/shell.sock

在lua中使用的时候更换下地址即可。

2021/06/23 17:24:20 [crit] 32063#0: *3941462 connect() to unix:/tmp/shell.sock failed (2: No such file or directory), client: 172.25.42.35, server: , request: "GET /test/ HTTP/1.1", host: "192.168.65.94:19999"
2021/06/23 17:24:30 [crit] 32155#0: *3941508 connect() to unix:/tmp/shell.sock failed (2: No such file or directory), client: 172.25.42.35, server: , request: "GET /test/ HTTP/1.1", host: "192.168.65.94:19999"
2021/06/23 17:24:45 [crit] 32568#0: *3941567 connect() to unix:/tmp/shell.sock failed (2: No such file or directory), client: 172.25.42.35, server: , request: "GET /test/ HTTP/1.1", host: "192.168.65.94:19999"
2021/06/23 17:25:06 [crit] 32568#0: *3941567 connect() to unix:/tmp/shell.sock failed (2: No such file or directory), client: 172.25.42.35, server: , request: "GET /test/ HTTP/1.1", host: "192.168.65.94:19999"
2021/06/24 08:08:57 [crit] 32568#0: *4105349 connect() to unix:/tmp/shell.sock failed (2: No such file or directory), client: 127.0.0.1, server: , request: "HEAD /test/ HTTP/1.1", host: "localhost:19999"
2021/06/24 08:08:59 [crit] 32568#0: *4105353 connect() to unix:/tmp/shell.sock failed (2: No such file or directory), client: 127.0.0.1, server: , request: "GET /test/ HTTP/1.1", host: "localhost:19999"
2021/06/24 08:10:30 [crit] 32569#0: *4105722 connect() to unix:/tmp/shell.sock failed (2: No such file or directory), client: 127.0.0.1, server: , request: "GET /test/ HTTP/1.1", host: "localhost:19999"

服务器重启后shell.sock无法连接

connect() to unix:/data/shell/shell.sock failed (111: Connection refused)

2021/06/24 08:08:57 [crit] 32568#0: *4105349 connect() to unix:/data/shell/shell.sock failed (111: Connection refused), client: 127.0.0.1, server: , request: "HEAD /test/ HTTP/1.1", host: "localhost:19999"
2021/06/24 08:08:59 [crit] 32568#0: *4105353 connect() to unix:/data/shell/shell.sock failed (111: Connection refused), client: 127.0.0.1, server: , request: "GET /test/ HTTP/1.1", host: "localhost:19999"
2021/06/24 08:10:30 [crit] 32569#0: *4105722 connect() to unix:/data/shell/shell.sock failed (111: Connection refused), client: 127.0.0.1, server: , request: "GET /test/ HTTP/1.1", host: "localhost:19999"

服务器重启后,就会报错

connect() to unix:/data/shell/shell.sock failed (111: Connection refused)

所以需要重新执行命令,给 /data/shell.sock 权限

./sockproc /data/shell.sock
chmod 0666 /data/shell.sock

我们可以把这两个命令放到开机启动时自动执行的脚本中。

vim /etc/rc.d/rc.local 内容如下:

touch /var/lock/subsys/local
sudo /usr/local/k8s/lua/sockproc/sockproc /data/shell/shell.sock
sudo chmod 0666 /data/shell/shell.sock

CSDN_码404:nginx,lua,shell执行服务器脚本问题connect() to unix:/tmp/shell.sock failed (2: No such file or directory)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

leenhem

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值