macos版本:10.15.7
apache和php是macos系統自帶的,Apache/2.4.41 (Unix) PHP/7.3.11
mysql版本:8.0.22 MySQL Community Server
phpMyAdmin版本資訊: 5.0.4 運作正常
問題1:通路網站時提示"Forbidden"
配置httpd.conf 的DocumentRoot路徑時,如果把目錄放在文檔、桌面等目錄裡,浏覽器運作localhost時,提示"403 Forbidden" ,查了很多文檔,最後解決了。
DocumentRoot的目錄放到/Users/username/即可,而放到文檔(/Users/username/Documents)等系統目錄裡,沒有檔案權限。
如果用預設的目錄:/Library/WebServer/Documents,則也運作正常,It works!因為資源庫(/Library/)目錄是用需要的權限的。
問題2:httpd.conf配置<Directory>
#開啟目錄清單索引模式
Options Indexes
#排序先允許allow再deny
Order allow,deny
#設定字元集,以消除中文亂碼;指定目錄清單可以顯示最長為255位元組的檔案/目錄名
IndexOptions NameWidth=255 Charset=UTF-8
#允許所有
Allow from all
問題3:連結資料庫時用127.0.0.1代替localhost
安裝wordpress Version 5.6 時,資料庫伺服器用127.0.0.1即可,用預設的localhost出錯。