Laravel Homestead: Nginx failing to start on Vagrant. Need root password to access Nginx logs

天大地大妈咪最大 提交于 2019-12-10 15:49:22

问题


Using Laravel Homestead to work with Laravel 4. After running vagrant up this 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.

My question then, what is the su or sudo password 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.


回答1:


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.




回答2:


i had similar issue with laravel/homestead vagrant virtual machine and nginx not restarting. the error after running nginx -t was :

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:

rm -Rf /etc/nginx/sites-enabled/sites-available

than it worked: service nginx restart




回答3:


elevate to root by typing sudo -s




回答4:


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.

If you forgot the root password, just search google to recover it.



来源:https://stackoverflow.com/questions/24368281/laravel-homestead-nginx-failing-to-start-on-vagrant-need-root-password-to-acce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!