繁体   English   中英

Laravel 5 空白页

[英]Laravel 5 blank page

我的页面托管在 Amazon EC2 中,它在 apache 服务器 (/var/www/html) 的根目录中运行良好。 但我想在同一台服务器上有另一个页面,所以我开始将它移动到一个子文件夹(/var/www/html/alqip/public),这样我就可以在(/var/www/html/page2)中设置第二个网站.

该站点是在 Laravel 5 中开发的,它显示一个空白页面,没有登录 Laravel 日志和系统日志(syslog、apache 日志、php 日志)中的任何错误。

存储文件夹的权限是777。

这是我在 public/ 文件夹中的.htaccess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

我在 /var/apache2/sites-available 中的page.config

<VirtualHost *:80>
      ServerName alqip.com
      ServerAlias www.alqip.com
      DocumentRoot "/var/www/html/alqip/public"
      <Directory "/var/www/html/alqip/public">
                    AllowOverride All
      </Directory>
    </VirtualHost>

我认为问题出在 Laravel 上,而不是服务器配置上,你怎么看? 谢谢!

验证防火墙是否关闭,如果您使用的是 centos,请检查 selinux 的配​​置。 默认情况下启用 selinux 编辑文件/etc/selinux/config

SELINUX=禁用

禁用后,您必须重新启动服务器

安装 Laravel 后,您必须使用 .envexample 模板创建 .env 文件。

您将遇到的下一个问题是权限问题

这是因为 php 默认以另一个用户身份运行。

所以要解决这个问题

sudo nano /etc/php/7.0/fpm/pool.d/www.conf

然后编辑user = "put user that owns the directories" group = "put user that owns the directories"

然后:

sudo systemctl reload php7.0-fpm

暂无
暂无

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

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