问题描述
我想将Laravel Nova移至nova.mydomain.com
,而不是mydomain.de/nova
。我已经搜索了GitHub和Stackoverflow,但是这些解决方案对我不起作用。目前,我正在尝试this one。
它也有效。现在可以在nova.mydomain.de
下找到Nova。但是,现在我面临着另外三个问题。
-
当我尝试访问
mydomain.de
上的主域时,我还看到了Laravel Nova仪表板。它甚至没有重定向我,只是在主域上向我显示了Laravel Nova仪表板! -
完整站点(包括来自主域的所有路由)也位于
下也可用nova.
下。例如mydomain.com/post/myFirstPost
在nova.mydomain.com/post/myFirstPost
我在装有Laravel Valet
和Laravel 8
的Mac上运行。我在nova
文件夹中创建了一个Sites
目录,其中也包含mydomain
项目。 nova
文件夹只是指向mydomain
项目的符号链接。
我该如何解决我的问题...很遗憾,在线讨论和解决方案并不多。
<?PHP
use Laravel\Nova\Actions\ActionResource;
use Laravel\Nova\Http\Middleware\Authenticate;
use Laravel\Nova\Http\Middleware\Authorize;
use Laravel\Nova\Http\Middleware\Boottools;
use Laravel\Nova\Http\Middleware\dispatchServingNovaEvent;
return [
/*
|--------------------------------------------------------------------------
| Nova App Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to display the name of the application within the UI
| or in other locations. Of course,you're free to change the value.
|
*/
'name' => env('NOVA_APP_NAME',env('APP_NAME')),/*
|--------------------------------------------------------------------------
| Nova App URL
|--------------------------------------------------------------------------
|
| This URL is where users will be directed when clicking the application
| name in the Nova navigation bar. You are free to change this URL to
| any location you wish depending on the needs of your application.
|
*/
'url' => 'nova.' . env('APP_DOMAIN'),/*
|--------------------------------------------------------------------------
| Nova Path
|--------------------------------------------------------------------------
|
| This is the URI path where Nova will be accessible from. Feel free to
| change this path to anything you like. Note that this URI will not
| affect Nova's internal API routes which aren't exposed to users.
|
*/
'path' => '/',/*
|--------------------------------------------------------------------------
| Nova Authentication Guard
|--------------------------------------------------------------------------
|
| This configuration option defines the authentication guard that will
| be used to protect your Nova routes. This option should match one
| of the authentication guards defined in the "auth" config file.
|
*/
'guard' => env('NOVA_GUARD',null),/*
|--------------------------------------------------------------------------
| Nova Password Reset broker
|--------------------------------------------------------------------------
|
| This configuration option defines the password broker that will be
| used when passwords are reset. This option should mirror one of
| the password reset options defined in the "auth" config file.
|
*/
'passwords' => env('NOVA_PASSWORDS',/*
|--------------------------------------------------------------------------
| Nova Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will be assigned to every Nova route,giving you the
| chance to add your own middleware to this stack or override any of
| the existing middleware. Or,you can just stick with this stack.
|
*/
'middleware' => [
'web',Authenticate::class,dispatchServingNovaEvent::class,Boottools::class,Authorize::class,\Vyuldashev\NovaPermission\ForgetCachedPermissions::class,],/*
|--------------------------------------------------------------------------
| Nova Pagination Type
|--------------------------------------------------------------------------
|
| This option defines the visual style used in Nova's resource pagination.
| You may choose between 3 types: "simple","load-more" and "links".
| Feel free to set this option to the visual style you like.
|
*/
'pagination' => 'simple',/*
|--------------------------------------------------------------------------
| Nova Action Resource Class
|--------------------------------------------------------------------------
|
| This configuration option allows you to specify a custom resource class
| to use instead of the one that ships with Nova. You may use this to
| define any extra form fields or other custom behavior you need.
|
*/
'actions' => [
'resource' => ActionResource::class,];
亲切的问候
解决方法
-
将您的子域根目录设置为主域根目录。这通常必须在您的网络服务器中完成,例如 apache、nginx
-
将
domain
中的config/nova.php
设置为您的子域。 -
别忘了
php artisan optimize:clear