我在不同的文件夹中有两个laravel项目
var/www/html/lab1
var/www/html/lab2
当我访问一个项目的一条路线时,这条路线会调用其他项目!
示例:我访问domain.com/public/api/lab1/user并调用domain.com/lab2/api/user
我正在使用apache2,我不知道发生了什么
这出现在日志文件
中 File: /xxx/xxx/xxx/xxx/dev/vendor/laravel/lumen-framework/src/Application.php
Line: 1176
CLASS: Symfony\Component\HttpKernel\Exception\NotFoundHttpException
traceAsString: #0 /xxx/xxx/xxx/xxx/dev/vendor/laravel/lumen-framework/src/Application.php(1134): Laravel\Lumen\Application->handleDispatcherResponse(Array)
#1 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\{closure}(Object(Illuminate\Http\Request))
#2 /xxx/xxx/xxx/xxx/dev/vendor/illuminate/pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#3 /xxx/xxx/xxx/xxx/dev/app/Http/Middleware/CorsMiddleware.php(8): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#4 [internal function]: App\Http\Middleware\CorsMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#5 /xxx/xxx/xxx/xxx/dev/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#6 /xxx/xxx/xxx/xxx/dev/vendor/illuminate/cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#7 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#8 /xxx/xxx/xxx/xxx/dev/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#9 /xxx/xxx/xxx/xxx/dev/vendor/lucadegasperi/oauth2-server-laravel/src/Middleware/OAuthExceptionHandlerMiddleware.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#10 [internal function]: LucaDegasperi\OAuth2Server\Middleware\OAuthExceptionHandlerMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#11 /xxx/xxx/xxx/xxx/dev/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#13 /xxx/xxx/xxx/xxx/dev/vendor/illuminate/pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#14 /xxx/xxx/xxx/xxx/dev/vendor/laravel/lumen-framework/src/Application.php(1354): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#15 /xxx/xxx/xxx/xxx/dev/vendor/laravel/lumen-framework/src/Application.php(1135): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#16 /xxx/xxx/xxx/xxx/dev/vendor/laravel/lumen-framework/src/Application.php(1073): Laravel\Lumen\Application->dispatch(Object(Illuminate\Http\Request))
#17 /xxx/xxx/xxx/xxx/dev/public/index.php(28): Laravel\Lumen\Application->run(Object(Illuminate\Http\Request))
#18 {main}
虚拟主机
<VirtualHost *:9022>
DocumentRoot /var/www/html/api
<Directory /var/www/html/api>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:9019>
ServerName servername
DocumentRoot /var/www/html/api2
<Directory /var/www/html/api2>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
有什么想法吗?
答案 0 :(得分:0)
您的documentRoot和虚拟主机中的目录显示的内容与您在顶部所说的内容不同(var / www / html / lab1)。
将documentRoot和目录更改为/ var / www / html / api / public 和/ var / www / html / api2 / public
因为laravel从公共文件夹中的index.php引导整个laravel框架