博主的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 服务器就不会初现404报错了
sudo apachectl start
网友评论