简体   繁体   English

Laravel和VestaCP HTTP错误500

[英]Laravel & VestaCP HTTP Error 500

I recently set up my VPS on CentOS 7 with VestaCP, as I've heard many great things about it. 我最近用VestaCP在CentOS 7上设置了VPS,因为我听说过很多很棒的事情。 Everything is great except that I can't run a Laravel project on it. 一切都很棒,除了我无法在其上运行Laravel项目。 I've followed a couple of tutorials on how to set up a Laravel project on VestaCP, but it doesn't do anything. 我遵循了一些有关如何在VestaCP上设置Laravel项目的教程,但是它没有任何作用。

I have the contents of my public folder in public_html , and I have everything else in private/laravel folder, outside of public_html . 我有我的内容, public文件夹中public_html ,而我在一切private/laravel文件夹,以外public_html I edited the index.php file to include bootstrap/autoload and bootstrap/app like I always do when uploading projects to hosting, but this time it doesn't work at all, and throws me a HTTP ERROR 500. 我将index.php文件编辑为包括bootstrap/autoloadbootstrap/app就像将项目上载到主机时一样,但这一次它根本不起作用,并抛出HTTP ERROR 500。

My initial thoughts were that it must be Apache permissions, but that didn't work at all. 我最初的想法是必须具有Apache权限,但这根本不起作用。 If anyone can help me out at all, I'd be really grateful. 如果有人可以帮助我,我将非常感激。

The error occurs because php is not given access to your private/laravel directory. 发生错误是因为未授予php访问您的private/laravel目录的权限。 You can check for this in the logs in /var/log/httpd/domains/yourdomain.com.error.log . 您可以在/var/log/httpd/domains/yourdomain.com.error.log中的日志中进行检查。 If the log message says open_basedir restriction in effect then you can confirm the problem. 如果日志消息显示open_basedir restriction in effect那么您可以确认问题。

To resolve this you need to add your private/laravel directory into the open_basedir path in /home/username/conf/web/httpd.conf and /home/username/conf/web/shttpd.conf . 要解决此问题,您需要将您的private/laravel目录添加到/home/username/conf/web/httpd.conf/home/username/conf/web/shttpd.conf的open_basedir路径中。

  • In the .conf file, find listing corresponding to the domain for which the error occurs. .conf文件中,找到与发生错误的域相对应的列表。
  • Append your path to this line php_admin_value open_basedir /home/username/web/yourdomain.com/public_html:/home/username/tmp . 将您的路径添加到此行php_admin_value open_basedir /home/username/web/yourdomain.com/public_html:/home/username/tmp
  • After appending the path the line will be like this php_admin_value open_basedir /home/username/web/yourdomain.com/public_html:/home/username/tmp:/home/username/web/yourdomain.com/private/laravel . 追加路径后,该行将类似于php_admin_value open_basedir /home/username/web/yourdomain.com/public_html:/home/username/tmp:/home/username/web/yourdomain.com/private/laravel
  • Save and exit. 保存并退出。
  • Now restart your apache server service httpd restart . 现在重启您的apache服务器service httpd restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM