博主的apache 自定義目錄為:/Volumes/Volumes/Repo/Apache
首先打開/etc/apache2/httpd.conf,并且關閉 apache 服務器
sudo apachectl stop
找到DocumentRoot,按照下面配置修改配置文件,
#DocumentRoot "/Library/WebServer/Documents"
#<Directory "/Library/WebServer/Documents">
# 自定義 DocumentRoot 路徑
DocumentRoot "/Volumes/Volumes/Repo/Apache"
<Directory "/Volumes/Volumes/Repo/Apache">
Options FollowSymLinks Multiviews
Options Indexes FollowSymLinks
MultiviewsMatch Any
Require all granted
</Directory>
<Directory />
dexes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
然后在終端輸入sudo chmod -R 755 /Volumes/Volumes/Repo/Apache
然后在開啟 apache 服務器就不會初現(xiàn)404報錯了
sudo apachectl start