找不到请求的URL-Laravel 5 [英] Requested URL not found - Laravel 5

查看:259
本文介绍了找不到请求的URL-Laravel 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个Web应用程序(我使用Laravel 5制作)上载到DigitalOcean Droplet.但是出现 404错误:

I am trying to upload a web app (which I made using Laravel 5) to a DigitalOcean droplet. But I get a 404 Error:

在此服务器上找不到请求的URL/public/login.

The requested URL /public/login was not found on this server.

这是我的 apache2.conf

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/html/hotelguide/public> 
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

000-default.conf

<VirtualHost *:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/hotelguide/public

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

这是我的文件夹结构

This is my folder structure

这是php artisan route:list的输出

This is the output of php artisan route:list

更新:LARAVEL日志

Stack trace:
#0 /var/www/html/hotelguide/vendor/symfony/console/Application.php(183): Symfony\Component\Console\Application->find('routes')
#1 /var/www/html/hotelguide/vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/html/hotelguide/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/hotelguide/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 {main}

更新:PHP错误日志(最后一个错误)

124.43.95.22 - - [02/Sep/2016:14:01:29 +0530] "GET /login HTTP/1.1" 500 206 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"

完成Alexey详细说明的步骤后,我现在收到HTTP 500错误.

After completing the steps detailed by Alexey I am now getting an HTTP 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>

更新:未发现CSS和JS错误

推荐答案

基于先前的讨论:

  • 您的APACHE_RUN_USER& APACHE_RUN_GROUP是 www数据
  • 您的/var/www/html/hotelguide/public文件夹所有者是 root ,其组是 www-pub
  • your APACHE_RUN_USER & APACHE_RUN_GROUP are www-data
  • your /var/www/html/hotelguide/public folder owner is root and its group is www-pub

public文件夹的当前许可权对Apache不利.
因此,您必须在此目录中授予Apache的权限,并且只需输入以下命令即可:

The current permission of your public folder are not good for Apache.
Therefore you have to give permission to Apache in this directory, and to do that, you will just have to type this command :

chown -R www-data:www-data /var/www/html/hotelguide/

这篇关于找不到请求的URL-Laravel 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆