【问题标题】:Setting up laravel 5 on Centos server在 Centos 服务器上设置 laravel 5
【发布时间】:2016-09-09 19:46:19
【问题描述】:

我正在尝试设置一个安装了 LAMP 的 Centos 服务器。

我已经成功创建了一个 laravel 项目,但是当我打开一个路由 (/) 时,它仍然显示 500 ERROR 我不知道配置哪里出错了。

这是我的 htaccess 文件的样子:

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

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

这是我的 /etc/httpd/conf/httpd.conf 文件的样子:

DocumentRoot "/var/www/html"

#
# Relax access to content within /var/www.
#
<Directory "/var/www">
    AllowOverride none
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
<Directory "/var/www/html">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride none

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

我也安装了所有必需的插件。

我安装了 wordpress,它似乎运行顺利。但我不知道为什么它不能用这个。

这是我的项目 URL http://104.199.222.145/demo2/ 我刚刚做了一个基本的 laravel 安装。

我认为这是某个地方更多的 .htaccess 问题。但不确定。

谢谢!

【问题讨论】:

    标签: php apache .htaccess laravel centos7


    【解决方案1】:

    你是否设置了 laravel 文件夹的权限?

    sudo chmod 755 -R demo2
    chmod -R o+w demo2/storage
    

    【讨论】:

    • 我试过这个,但没有用。你可以检查一下。 104.199.222.145/demo2。我也把AllowOverride none的所有东西都做成AllowOverride All
    • 您对 /routes/web.php 做了哪些更改?
    • 我没有做任何更改,只是添加了一条新路由,就像我们一直使用回调函数一样。
    【解决方案2】:

    您在服务器上安装的 laravel 版本是什么? 你的服务器 php 版本是什么?如果不满足要求,laravel 会抛出 500 错误。

    【讨论】:

    • 我正在尝试安装 PHP 7 和 larval 5.3 版本。我也尝试过 5.2。但在这两种情况下都不起作用。
    • 你说的是在 laravel 里?
    • 在 laravel 和你的服务器上
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-14
    • 2013-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-06
    • 1970-01-01
    相关资源
    最近更新 更多