mac修改apache中httpd.conf,修改默认访问路径

1. 打开修改/etc/apache2/httpd.conf内容, 查找如下:

[html]  view plain  copy
  1. DocumentRoot "/Library/WebServer/Documents"  
  2. <Directory "/Library/WebServer/Documents">  
  3.     #  
  4.     # Possible values for the Options directive are "None", "All",  
  5.     # or any combination of:  
  6.     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews  
  7.     #  
  8.     # Note that "MultiViews" must be named *explicitly* --- "Options All"  
  9.     # doesn't give it to you.  
  10.     #  
  11.     # The Options directive is both complicated and important.  Please see  
  12.     # http://httpd.apache.org/docs/2.4/mod/core.html#options  
  13.     # for more information.  
  14.     #  
  15.     Options FollowSymLinks Multiviews  
  16.     MultiviewsMatch Any  
  17.   
  18.     #  
  19.     # AllowOverride controls what directives may be placed in .htaccess files.  
  20.     # It can be "All", "None", or any combination of the keywords:  
  21.     #   AllowOverride FileInfo AuthConfig Limit  
  22.     #  
  23.     AllowOverride None  
  24.   
  25.     #  
  26.     # Controls who can get stuff from this server.  
  27.     #  
  28.     Require all granted  
  29. </Directory>  
原来Apache根目录是/Library/WebServer/Documents, 现改为/Users/username/phpSites, 如下:

[html]  view plain  copy
  1. DocumentRoot /Users/username/phpSites  
  2. <Directory /Users/username/phpSites>  
  3.     Options Indexes MultiViews  
  4.     # apache 2.2  
  5.     # AllowOverride All  
  6.     # Order allow,deny  
  7.     # Allow from 127.0.0.1  
  8.   
  9.     # apache 2.4  
  10.     Require local  
  11. </Directory>  

Apache运行命令:

sudo apachectl start  //开始
sudo apachectl restart  //重启
sudo apachectl stop  //停止

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值