带有Elasticbeanstalk的Laravel:除'/'路由外,所有路由都返回404

问题描述 投票:0回答:1

我需要将非常简单的laravel 7应用程序部署到Elasticbeanstalk,我做了所有的事情just like this tutorial一切正常,直到我单击/路线以外的任何其他路线。

http://laravelbooksystem-env.eba-vmyh6fvn.us-east-2.elasticbeanstalk.com/(正在工作)

[http://laravelbooksystem-env.eba-vmyh6fvn.us-east-2.elasticbeanstalk.com/experts(无效)

web.php

Route::get('/', function () {
    return view('welcome');
});


Route::get('/experts', 'ExpertsController@index');

Route::get('/experts/{id}/show', 'ExpertsController@show');

Route::get('/experts/{id}/book', 'AppointmentsController@display');


Route::post('/appointment/{id}', 'AppointmentsController@store');

。htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    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]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

。ebextentions

container_commands:
    01_clear_config:
        command: "php artisan config:clear"
    02_clear_cache:
        command: "php artisan cache:clear"    
    03_build_db:
        command: "php artisan migrate --force"
    04_seed:
        command: "php artisan db:seed --force"    

关于如何解决此问题的任何线索?

laravel amazon-elastic-beanstalk
1个回答
0
投票

我遇到了这个问题,并按照niallD在此处发布的说明解决了该问题:Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

© www.soinside.com 2019 - 2024. All rights reserved.