Laravel Homestead:Nginx 无法在 Vagrant 上启动。需要 root 密码才能访问 Nginx 日志
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24368281/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel Homestead: Nginx failing to start on Vagrant. Need root password to access Nginx logs
提问by sparecycle
Using Laravel Homestead to work with Laravel 4. After running vagrant upthis morning, I was unable to access homestead.app:8000. I pinged it with no problem so I investigated my virtualbox and discovered that Nginx wasn't starting. I then attempted to view logs and I am denied permission from the /var/log/nginx directory which is owned by www-data adm.
使用 Laravel Homestead 与 Laravel 4 配合使用。今天早上运行vagrant 后,我无法访问 homestead.app:8000。我 ping 它没有问题,所以我调查了我的 virtualbox 并发现 Nginx 没有启动。然后我尝试查看日志,但我拒绝了www-data adm拥有的 /var/log/nginx 目录的许可。
My question then, what is the suor sudopassword which would allow me to access that directory? The documentation is surprisingly void of any information as well as the Homestead.app Git repository. Thank you.
那么我的问题是,允许我访问该目录的su或sudo密码是什么?该文档令人惊讶地没有任何信息以及 Homestead.app Git 存储库。谢谢你。
回答by ulkas
i had similar issue with laravel/homestead
vagrant virtual machine and nginx
not restarting. the error after running nginx -t
was :
我在laravel/homestead
vagrant 虚拟机上遇到了类似的问题,但nginx
没有重新启动。运行后的错误nginx -t
是:
nginx: [crit] pread() "/etc/nginx/sites-enabled/sites-available" failed (21: Is a directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
solution was to delete the symbolic link sites_available
:
解决方案是删除符号链接sites_available
:
rm -Rf /etc/nginx/sites-enabled/sites-available
than it worked:
service nginx restart
比它有效:
service nginx restart
回答by adiel
elevate to root by typing sudo -s
通过键入 sudo -s 提升到 root
回答by noeldiaz
A quick way to jump to a root account shell is to run the "sudo bash" command. That way, if you don't have to have to type "sudo" in front of each command. Since this VM is for development purposes I don't see it as a danger, but in real production Ubuntu runs with the root account locked down so you always go in and should stay in with user level privileges until you need to execute a higher level command. You "can" enable the root account and set a password, but jumping to it with sudo is the better method.
跳转到 root 帐户 shell 的一种快速方法是运行“sudo bash”命令。这样,如果您不必在每个命令前键入“sudo”。由于此 VM 用于开发目的,我不认为它有危险,但在实际生产中,Ubuntu 在 root 帐户锁定的情况下运行,因此您始终进入并应保持用户级权限,直到您需要执行更高级别命令。您“可以”启用 root 帐户并设置密码,但使用 sudo 跳转到它是更好的方法。
回答by rhbvkleef
You can just look at the log using the root
account password. So: sudo nano and then just enter your root
user's password. A root is able to do anything on the system, so that always is a solution for this kind of problems.
您可以使用root
帐户密码查看日志。所以: sudo nano 然后只需输入您的root
用户密码。root 可以在系统上做任何事情,所以这总是解决这类问题的方法。
If you forgot the root password, just search google to recover it.
如果您忘记了 root 密码,只需搜索谷歌即可恢复。