laravel 筆記 虛擬網站設定

laravel 的虛擬網站設定

因為使用者看到的 laravel 網頁,實體位置是在 newedApp/public 裏,所以用 apache 預設的 userdir 設定恐怕是得繞些路,而且因為有機會瀏覽核心的文件,在安全上疑慮可能多一些,所以這次要針對這個部份加以設定,把使用者直接導到 newedApp/public 目錄。

以下範例,以 abc 的 app 專案為例,依樣畫狐狸就可以連到 app 的網站:
將設定存到 /etc/apache2/sites-availabe/abc.conf >
sudo a2ensite abc.conf ,/etc/apache2/sites-enabled 下就會多一個連結 >
sudo service apache2 restart

/etc/apache2/sites-availabe/abc.conf:
<virtualhost>
 ServerAdmin webmaster@dummy-host.example.com
 DocumentRoot "/home/abc/public_html/app/public"
 ServerName abc.local
 ServerAlias www.abc.local

  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

     <directory "/home/ricky/public_html/emsl/public">
         Options Indexes MultiViews FollowSymLinks
         AllowOverride All
         Require all granted
     </directory>
</virtualhost>


如果沒有 dns 而須要使用網域名稱來連接 ,則須設定 /etc/hosts 檔案,加上一行 「ip    對應位址」,例如: 127.0.0.1    abc.local,windows 的 hosts 設定大同小異,詳另文 Windows 的名稱解析設定 hosts

留言

這個網誌中的熱門文章

使用 Excel 計算2個地點之間的直線距離

LINE 儲存的檔案傳到 email 不方便 很不方便 非常不方便 但是有解的筆記

Excel 巨集合併多個 Excel 檔案