久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      Laravel如何在本地搭建多站點(diǎn)

      下面由Laravel框架教程欄目給大家介紹Laravel在本地搭建多站點(diǎn),希望對需要的朋友有所幫助!

      Laravel如何在本地搭建多站點(diǎn)

      前言

      最近的想法挺多的,又想做這個又想做那個.但是碰到一個很難受的問題就是:

      1. 沒有整理好歷來所有的代碼,沒有一個存儲的路徑或方案.
      2. 沒有對這些代碼進(jìn)行統(tǒng)一的管理方案.

      所以對我來說,眼下最要緊的事,就是先整理好代碼,然后開發(fā)出一套屬于自己的本地化管理工具.

      這個工具目前暫定為Laravel進(jìn)行開發(fā).采用的是前后端分離的策略,以便日后多端可以有相應(yīng)的api進(jìn)行使用.

      然后我也不是特別喜歡多開好幾個Laravel進(jìn)行開發(fā),所以一個Laravel框架中,同時包含多域名也是成為一個主要的問題之一.

      今天我就好好的記錄下,我用Laravel在本地化進(jìn)行多域名的設(shè)置.其實(shí)架設(shè)到其他的系統(tǒng)其實(shí)都差不多的.

      方案

      目前決定先分為兩個域名.

      一個是API的接口域名,我定為: api.hellolux.com

      一個是后臺管理域名,我定為: admin.hellolux.com

      實(shí)現(xiàn)

      在Controller層新增文件夾

      在appHttpControllers目錄下,新增兩個文件夾,分別為Api和Admin.

      修改RouteServiceProvider.php文件

      在appProvidersRouteServiceProvider.php中,修改

      # 新增項(xiàng)目名稱的命名空間 protected $AdminNamespace = 'AppHttpControllersAdmin'; protected $ApiNamespace = 'AppHttpControllersApi';  public function map() {     # 根據(jù)項(xiàng)目名稱定義路由     $this->mapApiRoutes();     $this->mapAdminRoutes(); }  # 新增兩個方法 protected function mapAdminRoutes() {     Route::group([         'domain' => config('app.admin_domain'),         'namespace' => $this->AdminNamespace,     ], function ($router) {         require base_path('routes/admin.php');     }); } protected function mapApiRoutes() {     Route::group([         'domain' => config('app.api_domain'),         'namespace' => $this->ApiNamespace,     ], function ($router) {         require base_path('routes/api.php');     }); }

      在config/app.php新增

      'api_domain' => env('API_DOMAIN', 'api.hellolux.com'), 'admin_domain' => env('ADMIN_DOMAIN', 'admin.hellolux.com'),

      在.env中新增

      API_DOMAIN=api.hellolux.com ADMIN_DOMAIN=admin.hellolux.com

      在routes目錄下,新增api.php和admin.php兩個文件

      # api.php use IlluminateHttpRequest;  Route::get('/', "IndexController@index");    # admin.php use IlluminateHttpRequest;  Route::get('/', "IndexController@index");

      在/etc/hosts中增加域名

      # Local_Manage 127.0.0.1   api.hellolux.com 127.0.0.1   admin.hellolux.com

      /etc/apache2/http.conf中取消vhosts注釋

      Include /private/etc/apache2/extra/httpd-vhosts.conf

      在/etc/apache2/extra/httpd-vhosts.conf中,新增

      <VirtualHost *:80>     ServerAdmin hellolux@163.com     DocumentRoot "/Users/hellolux/Documents/Github/Local_Manage/public"     ServerName hellolux     ServerAlias *.hellolux.com     ErrorLog "/Users/hellolux/Documents/Github/Local_Manage/logs/error.log"     CustomLog "/Users/hellolux/Documents/Github/Local_Manage/logs/access.log" common </VirtualHost>

      重啟apache

      sudo apachevtl restart

      完成

      瀏覽器打開admin.hellolux.com和api.hellolux.com分別會顯示具體的頁面了.

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號