我正在尝试将一个Web应用程序(我使用Laravel 5制作)上传到DigitalOcean Droplet。但是我得到了 404错误:
在此服务器上找不到请求的URL / public / login。
这是我的 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>
更新: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}
更新: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错误。
更新: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>
答案 0 :(得分:1)
基于之前的讨论:
/var/www/html/hotelguide/public
文件夹所有者 root ,其群组 www-pub 您的public
文件夹的当前权限对Apache不利
因此,您必须在此目录中授予Apache权限,为此,您只需键入以下命令:
chown -R www-data:www-data /var/www/html/hotelguide/
答案 1 :(得分:0)
您需要point Apache to a public
directory并重新启动它:
DocumentRoot "/var/www/html/hotelguide/public"
<Directory "/var/www/html/hotelguide/public">
执行此操作后,请使用/login
网址而不是/public/login
。
答案 2 :(得分:0)
根据您项目的位置。在httpd.conf
中添加配置,如下所示:
<Directory "/var/www/html/project_name/public">
Allowoverride All
</Directory>