未加载的Laravel内腔路径

未加载的Laravel内腔路径,laravel,docker,apache2,lumen,Laravel,Docker,Apache2,Lumen,请注意,我已经在docker容器中部署了一个Lumen应用程序,运行Ubuntu和Apache2.4,但是我对该应用程序的所有请求都返回404,除了根 以下是我在阅读其他帖子时做的一些事情 通过运行a2enmod rewrite 将Require allowed和AllowOverride all添加到my conf文件中的目录指令 下面是我的000-default.conf文件的结构 <VirtualHost *:80> # The ServerName direc

请注意,我已经在docker容器中部署了一个Lumen应用程序,运行Ubuntu和Apache2.4,但是我对该应用程序的所有请求都返回404,除了根

以下是我在阅读其他帖子时做的一些事情

  • 通过运行
    a2enmod rewrite
  • Require allowed
    AllowOverride all
    添加到my conf文件中的目录指令
  • 下面是我的000-default.conf文件的结构

    <VirtualHost *:80>
            # The ServerName directive sets the request scheme, hostname and port that
            # the server uses to identify itself. This is used when creating
            # redirection URLs. In the context of virtual hosts, the ServerName
            # specifies what hostname must appear in the request's Host: header to
            # match this virtual host. For the default virtual host (this file) this
            # value is not decisive as it is used as a last resort host regardless.
            # However, you must set it for any further virtual host explicitly.
            #ServerName www.example.com
    
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/public
    
            <Directory /var/www/public>
                    Require all granted
                    AllowOverride All
            </Directory>
    
            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
            #LogLevel info ssl:warn
    
            ErrorLog /var/log/apache2/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
            # For most configuration files from conf-available/, which are
            # enabled or disabled at a global level, it is possible to
            # include a line for only one particular virtual host. For example the
            # following line enables the CGI configuration for this host only
            # after it has been globally disabled with "a2disconf".
            #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    
    编辑2:路线

    $api = $app->make(Dingo\Api\Routing\Router::class);
    
    $api->version('v1', [], function () use ($api) {
    
        $api->get('/', function () {
            return json_encode("Vendors API root");
        });
    
        $api->group(['prefix' => 'vendors', 'namespace' => 'App\Api\v1\Controllers'], function () use ($api) {
    
            // Vendor API Endpoints
            $api->get('/list', 'VendorController@listVendors');
            $api->get('/{id}/get', 'VendorController@getVendor');
            $api->post('/add', 'VendorController@addVendor');
        });
    
    });
    

    >我已经在docker容器中部署了Lumen应用程序如何?请提供一些关于您如何构建和运行Docker容器的信息。Docker似乎不是本文的主要问题。。。我认为问题在于我的apache配置。无论如何,我有一个
    docker compose
    和一个
    DockerFile
    配置来安装Apache,将我的代码推送到Digital Ocean,然后运行
    docker compose-up--build
    当然,但配置取决于代码在容器中的最终位置。您还提到运行
    a2enmod rewrite
    ,如果您碰巧正在运行此命令,然后在
    Dockerfile
    中复制配置,则可能会覆盖此命令的结果(因为这两个命令都会更改配置文件)。列出文件的内容可能也会有所帮助,因为此应用程序听起来可能还依赖于
    .htaccess
    文件。
    $api = $app->make(Dingo\Api\Routing\Router::class);
    
    $api->version('v1', [], function () use ($api) {
    
        $api->get('/', function () {
            return json_encode("Vendors API root");
        });
    
        $api->group(['prefix' => 'vendors', 'namespace' => 'App\Api\v1\Controllers'], function () use ($api) {
    
            // Vendor API Endpoints
            $api->get('/list', 'VendorController@listVendors');
            $api->get('/{id}/get', 'VendorController@getVendor');
            $api->post('/add', 'VendorController@addVendor');
        });
    
    });