user9492428 user9492428 - 3 months ago 28
Apache Configuration Question

Requested URL not found - Laravel 5

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


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


This is my 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
This is my folder structure

This is the output of php artisan route:list
This is the output of php artisan route:list

UPDATE: LARAVEL LOG

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}


UPDATE: PHP ERROR LOG (last error)

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"


After completing the steps detailed by Alexey I am now getting an HTTP 500 error.

UPDATE: HTACCESS FILE

<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>


UPDATE: CSS AND JS NOT FOUND ERROR
enter image description here

Answer

Based on the previous discussion :

  • 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

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/