程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了看起来 Laravel valet 正在启动两个 nginx 进程大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决看起来 Laravel valet 正在启动两个 nginx 进程?

开发过程中遇到看起来 Laravel valet 正在启动两个 nginx 进程的问题如何解决?下面主要结合日常开发的经验,给出你关于看起来 Laravel valet 正在启动两个 nginx 进程的解决方法建议,希望对你解决看起来 Laravel valet 正在启动两个 nginx 进程有所启发或帮助;

我现在已经尝试了大多数事情,所以我很想寻求帮助。我试图重新安装laravel valet。我也试过重新安装 brew,但我一直收到同样的错误。

当我运行 brew services List 时,我得到:

▶ brew services List
name    Status  User PList
dnsmasq unkNown root /library/launchdaemons/homebrew.mxcl.dnsmasq.pList
Nginx   error   root /library/launchdaemons/homebrew.mxcl.Nginx.pList
php     started root /library/launchdaemons/homebrew.mxcl.php.pList

如您所见,Nginx 出现错误。当我运行 sudo /usr/local/opt/Nginx/bin/Nginx -g 'daemon off;' 时,我得到以下输出:

Nginx: [emerg] bind() to 127.0.0.1:80 Failed (48: Address already in usE)
Nginx: [emerg] bind() to 127.0.0.1:80 Failed (48: Address already in usE)
Nginx: [emerg] bind() to 127.0.0.1:80 Failed (48: Address already in usE)
Nginx: [emerg] bind() to 127.0.0.1:80 Failed (48: Address already in usE)
Nginx: [emerg] bind() to 127.0.0.1:80 Failed (48: Address already in usE)
Nginx: [emerg] still Could not bind()

所以看起来有另一个 Nginx 进程以某种方式启动了?当我运行 sudo lsof -i tcp:80 时,我得到了这个:

▶ sudo lsof -i tcp:80
COMMAND   PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE name
Nginx   71557   root    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71558 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71559 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71560 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71561 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71562 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71563 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71564 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71565 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71567 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71568 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71569 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)
Nginx   71571 margul    6u  IPv4 0xb2e487bcf1edb7ad      0t0  TCP localhost:http (ListEN)

如果我在做 ps aux | grep "Nginx",我会得到这个:

▶ ps aux | grep "Nginx"
margul           71571   0,0  0,0  4319864   1352   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71569   0,0  4314744   1368   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71568   0,0  4333176   1420   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71567   0,0  4313720   1340   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71565   0,0  4315768   1408   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71564   0,0  4325252   2024   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71563   0,0  4331128   1396   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71562   0,0  4331128   1360   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71561   0,0  4313720   1372   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71560   0,0  4321912   1388   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71559   0,0  4330104   1380   ??  S    11:21pm   0:00.00 Nginx: worker process
margul           71558   0,0  4320888   1408   ??  S    11:21pm   0:00.00 Nginx: worker process
root             71557   0,0  4293560    612   ??  Ss   11:21pm   0:00.00 Nginx: master process Nginx
margul           97215   0,0  4277664    752 s001  R+   12:11am   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.IDea --exclude-dir=.tox Nginx

我已经没有什么可以尝试的了,我即将重新安装 MacOS,这只是为了让 Laravel 代客工作而疯狂。就像我说的,我曾多次尝试以各种不同的方式卸载 Laravel valet,重新启动,停止 Nginx 服务,卸载 brew。

如果有人能指出我正确的方向,那就太棒了。

解决方法

通过更新 xcode 解决了该问题(运行 brew doctor 时确保它显示“准备冲泡”)。然后我使用命令 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)" 删除了卸载的 brew。然后我通过执行 /usr/local 删除了 sudo -rf /usr/local/* 中的所有内容,以确保我已经删除了 brew 中的所有内容。

完成此操作后,我使用最新的新 xcode 重新安装了 brew,然后再次重新安装了 laravel valet,它工作正常。当我运行 brew services list 时,它仍然在 nginx 上显示错误,但它现在可以工作了。

▶ brew services list
Name    Status  User Plist
dnsmasq unknown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
nginx   error   root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php     started root /Library/LaunchDaemons/homebrew.mxcl.php.plist

大佬总结

以上是大佬教程为你收集整理的看起来 Laravel valet 正在启动两个 nginx 进程全部内容,希望文章能够帮你解决看起来 Laravel valet 正在启动两个 nginx 进程所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。