【发布时间】:2021-07-16 08:01:27
【问题描述】:
我有一个在服务器上正常运行的 Laravel 8 应用程序。我已将其移至另一台服务器,但我现在在新服务器上收到 404 Not Found。我没有更改新服务器上的任何内容,因此我认为这一定是与服务器相关的问题。我无法诊断服务器上的问题。详细信息是有关服务器上应用程序的一些详细信息:
文件权限遵循以下规定
chown -R apache.apache /var/www/LARAVEL_APP
chmod -R 755 /var/www/LARAVEL_APP
chmod -R 755 /var/www/LARAVEL_APP/storage
已使用以下命令清除路由和缓存:
php artisan route:clear
php artisan cache:clear
php artisan config:clear
php artisan cache:clear
LARAVEL-APP/public目录下的.htaccess文件:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
Options +FollowSymlinks
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
导航到 LARAVEL-APP 的根目录时,我可以正常看到以下屏幕。当我尝试加载位于LARAVEL-APP/public/index.php/admin/login 的index.html 时出现问题
路线列表
列表在做php artisan route:list | grep admin/login时可用
| | POST | admin/login | generated::LTvCw5lDDMDMdfPT | Brackets\AdminAuth\Http\Controllers\Auth\LoginController@login | web |
| | GET|HEAD | admin/login | brackets/admin-auth::admin/login | Brackets\AdminAuth\Http\Controllers\Auth\LoginController@showLoginForm
404 屏幕
【问题讨论】:
-
能否在.env中打开调试模式,看看这个404屏幕背后的错误是什么?
-
您使用的是什么服务器?它是如何设置的? “...home(/var/www/LARAVEL-APP)” 这不是您可以导航到的 URL,也不是“家”。里面的
public文件夹是“home”。当您使用php artisan serve提供文件时,一切正常吗? -
@harunB10,我试过了,没有显示
-
@Noor 您需要重新启动服务器才能看到错误消息。
-
@harunB10,我重启了,什么都没有显示
标签: php laravel deployment