我試著在谷歌搜索引擎中鍵入我網站的域名,并震驚地發現,那些不應該公開的應用程式檔案夾已經被索引了。檔案夾和檔案是像composer.json,一個供應商目錄,存盤目錄,資源目錄等等。
我是如何設定的:
應用程式是在public_html目錄下, index.php是入口,是在根目錄下(public_html) 其他的Laravel應用目錄保持原樣(默認的Laravel 7目錄結構)uj5u.com熱心網友回復:
應用程式在public_html目錄下, index.php是入口,在根目錄下(public_html) 其他Laravel應用程式的目錄保持原樣(默認的Laravel 7目錄結構)
在默認的Laravel安裝中, 專案目錄中沒有
index.php, 只有一個server.php. 如果你在這里做了任何改變, 請恢復它們, 因為這將導致一個重大的安全問題.唯一可以公開訪問的Laravel目錄是
.public.你使用的是Apache, 這意味著
DocumentRoot應該被設定為/path/to/your/project/public(其中public是Laravel的public目錄).這樣一來, 所有的檔案和目錄(
app,resources...)在這個目錄上面將無法訪問.uj5u.com熱心網友回復:
你應該把你所有的專案檔案移到根目錄,然后把你的檔案從
public復制到public_html,然后在Laravel中指向public_html:<?php namespace AppProviders。 使用 IlluminateSupportServiceProvider。 public function register() { $this->app->bind('path.public', function(){ return base_path().'/public_http'。 }); }你也可以看到。如何在laravel 5中把公共檔案夾改為public_html
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/324216.html
標籤:
上一篇:不能在模型中映射一對一的關系
下一篇:AppHttpControllersAuthVerificationController::show(Request$request)的宣告應該與...ControllersController::s
