在Centos服务器上设置laravel 5

时间:2016-09-09 11:13:51

标签: php apache .htaccess laravel centos7

我正在尝试安装一个安装了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,它似乎运行顺畅。但我不确定为什么它不能解决这个问题。

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

我认为这是一个更加.htaccess问题。但不确定。

谢谢!

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:0)

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