众所周知,Mac自带tomcat,并且根目录在/Library/WebServer/Document ,如果直接访问localhost就会访问到这个根目录,但是这个目录带有修改权限,那么如何解决这个问题呢,最好的办法就是修改apache的根目录,下面介绍如何修改
命令 过程中需要用到
sudo apachectl start ???启动apachesudo apachectl restart ?重新启动apache ?
首先修改httpd.conf配置文件
在终端中输入
sudo vim /etc/apache2/httpd.conf
在文件最下面找到这句
# Virtual hostsInclude /private/etc/apache2/extra/httpd-vhosts.conf
确保Include前面没有# 否则去掉# 保存并且推出
继续在终端中输入
sudo vim /etc/apache2/extra/httpd-vhosts.conf
把80的端口修改为
<VirtualHost *:80> ???ServerName ???localhost ???DocumentRoot ‘你想要的路径‘ ?????<Directory "你想要的路径"> ???????AllowOverride none ???????Require all denied ???????Options Indexes FollowSymLinks ???????AllowOverride None ???????Require all granted ???</Directory></VirtualHost>
保存推出,重启apache 现在访问http://localhost就是你自己的路径了
Mac下如何修改apache根目录
原文地址:http://www.cnblogs.com/chuangshaogreat/p/7821407.html