【问题标题】:Laravel with Elasticbeanstalk: All the routes return 404 except for '/' routeLaravel 与 Elasticbeanstalk:所有路由都返回 404,除了 '/' 路由
【发布时间】:2020-08-26 22:00:07
【问题描述】:

我需要将非常简单的 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>

.ebextensions

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"    

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

【问题讨论】:

  • 分享您的路线和刀片文件,以便我们为您提供帮助
  • @Makdous,一定要给我一个 mnt。

标签: laravel amazon-elastic-beanstalk


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2014-07-31
    • 2019-10-28
    • 2018-08-20
    • 2017-11-15
    • 2021-01-31
    • 1970-01-01
    • 2018-04-06
    • 2021-07-13
    • 1970-01-01
    相关资源
    最近更新 更多