mac中更改xampp的根目錄


方法一:

  • 1 打開 應用程序->XAMPP->xamppfiles->etc->httpd.conf 文檔
  • commond+f搜索htdocs,搜到如下結果
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
  • 3 修改DocumentRoot和Directory中的路徑為你想要的路徑,兩個的路徑要一樣

方法二:

  打開xampp -> Manage Servers -> Apache Web Server -> Configure -> Open Conf File ,之后同方法1的第二步

修改完之后在終止apache服務的時候可能會出現如下錯誤:

Stopping Apache Web Server...
Exit code: 8
Stdout:
apache config test fails, aborting
Stderr:
AH00526: Syntax error on line 229 of /Applications/XAMPP/xamppfiles/etc/httpd.conf:
DocumentRoot '/Applications/XAMPP/xamppfiles/\xe2\x80\x9c/Users/****/PhpstormProjects\xe2\x80\x9c' is not a directory, or is not readable

可以看到其中出現  \xe2\x80\x9c  的錯誤,主要是由於在修改DoucmentRoot時出現中文引號的原因,

“/Users/mac-user/Sites/domain/httpdocs”
This should be:
"/Users/mac-user/Sites/domain/httpdocs"

可參考 

https://stackoverflow.com/questions/27843813/apache-prefixing-path-to-virtual-hosts-path

https://stackoverflow.com/questions/22951499/mac-os-x-xampp-access-forbidden

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM