我的服务器中的Lumen安装在没有public / index.php的情况下访问时会发出NotFoundHttpException。
Apache配置:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/myapi/public
<Directory /var/www/html/myapi>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
htaccess的:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
目录结构:
> var/www/html
> ------------/myapi/ (lumen application)
> ------------/myapi/public/
var / www / html / myapi / public 中的index.php
$app->run($app->make('request'));
NotFoundHttpException:
答案 0 :(得分:2)
通过更改
解决了问题$app->run();
在/public/index.php
到
$request = Illuminate\Http\Request::capture();
$app->run($request);
答案 1 :(得分:0)
route.php
中列出时,会给出 NotFoundHttpException
$app->get('request', function() {
return view('your view file');
});