以下是修改 Laravel 应用程序的端口配置,
修改环境变量 APP_URL
来实现
app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Events\Dispatcher;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(Dispatcher $events)
{
//强制修改Laravel根地址
URL::forceRootUrl(env('APP_URL'));
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
}
.env
APP_URL=http://123.123.123.123:90/
配置可能不会生效,需要重启一下php