Laravelstream明路线不加载

请在Docker容器中部署一个Lumen应用程序,运行Ubuntu和Apache 2.4,但是我对该应用程序所做的所有请求都会返回404,除了根目录。

以下是我阅读其他文章所做的一些事情…

  1. 通过运行a2enmod rewrite启用模块a2enmod rewrite
  2. 添加Require all granted我的conf文件中的Require all grantedAllowOverride All到Directory指令

这是我的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, eg #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 

最后,当我运行php artisan route:list我看到的是以下…

+------+------+------------+------------+---------+------------+ | Verb | Path | NamedRoute | Controller | Action | Middleware | +------+------+------------+------------+---------+------------+ | GET | / | | None | Closure | | +------+------+------------+------------+---------+------------+

请问,我需要做些什么才能使这个工作?

编辑:这是我的.htaccess文件

 <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Apache seems to discard the Authorization header if it is not a # base64 encoded user/pass combo RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] # 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] </IfModule> 

编辑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'); }); });