:::
3-1 佈署到主機上
一、Apache的設定
- Apache 版本需要 2.4 以上
- 確認設定檔(如:
\xampp\apache\conf\httpd.conf) 中的設定- 確認底下module有啟動(前面無#註解符號):
- mod_authz_host
- mod_rewrite
DocumentRoot請設定至專案的 public 目錄,如:/安裝路徑/xampp/htdocs/exam56/public(若不打算變更的話,屆時只要在瀏覽器上輸入 http://localhost/exam56/public/ 亦可)- 接著找到網頁目錄的部份,將:
Options Indexes FollowSymLinks Includes ExecCGI
改為
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
- 例如:
DocumentRoot "/Users/tad/Dropbox/xampp/htdocs/exam56/public" <Directory "/Users/tad/Dropbox/xampp/htdocs/exam56/public"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks MultiViews Includes ExecCGI # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Require all granted </Directory> MultiViews的作用是當訪問到目錄中不存在的檔案時( 如訪問http://localhost/test/target), 則apache會尋找該目錄下的所有target.*檔案。如果test目錄下存在target.jpg檔案, 則會把這個檔案返回給客戶, 而不是直接傳回404錯誤訊息。
- 確認底下module有啟動(前面無#註解符號):
二、PHP的設定
- 確定 php.ini 中的這幾個延伸件有啟用(基本上最新版的XAMPP都有):
extension=openssl extension=fileinfo extension=pdo_mysql extension=mbstring
三、修改目錄權限
- 底下這幾個目錄需設為777(windows下不用)
- bootstrap/cache
- storage
- 改完後記得先stop Apache,然後再 start 以重新啟動之,此時,只要在瀏覽器上輸入 http://localhost 或 http://exam56.local/ 就可以看見網站了。
四、重設app_key
- 若是有出現
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.的訊息,請執行以下指令重設app_key即可php artisan key:generate php artisan config:clear
3. 建立使用者認證