mac 自带apache 修改documentRoot后报没有权限

忘是亡心i 2021-11-23 14:04 399阅读 0赞

mac apache 目录, /private/etc/apache2

修改 apache2/httpd.conf 文件

按照下面的修改即可

  1. 用户名
  2. 2个 Directory

    #

    If you wish httpd to run as a different user or group, you must run

    httpd as root initially and it will switch.

    #

    User/Group: The name (or #number) of the user/group to run httpd as.

    It is usually good practice to create a dedicated user and group for

    running httpd, as with most system services.

    #
    User qifeng # 用户名
    Group _www

  1. <Directory />
  2. # AllowOverride none
  3. AllowOverride all
  4. Options All
  5. allow from all
  6. # Require all denied
  7. </Directory>
  8. #
  9. # Note that from this point forward you must specifically allow
  10. # particular features to be enabled - so if something's not working as
  11. # you might expect, make sure that you have specifically enabled it
  12. # below.
  13. #
  14. #
  15. # DocumentRoot: The directory out of which you will serve your
  16. # documents. By default, all requests are taken from this directory, but
  17. # symbolic links and aliases may be used to point to other locations.
  18. #
  19. # DocumentRoot "/Library/WebServer/Documents"
  20. # <Directory "/Library/WebServer/Documents">
  21. DocumentRoot "/Users/qifeng/Desktop/qiphon/php"
  22. <Directory "/Users/qifeng/Desktop/qiphon/php">
  23. #
  24. # Possible values for the Options directive are "None", "All",
  25. # or any combination of:
  26. # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  27. #
  28. # Note that "MultiViews" must be named *explicitly* --- "Options All"
  29. # doesn't give it to you.
  30. #
  31. # The Options directive is both complicated and important. Please see
  32. # http://httpd.apache.org/docs/2.4/mod/core.html#options
  33. # for more information.
  34. #
  35. Options FollowSymLinks Multiviews
  36. # Options Indexes FollowSymLinks Multiviews
  37. MultiviewsMatch Any
  38. #
  39. # AllowOverride controls what directives may be placed in .htaccess files.
  40. # It can be "All", "None", or any combination of the keywords:
  41. # AllowOverride FileInfo AuthConfig Limit
  42. #
  43. # AllowOverride None
  44. AllowOverride All
  45. #
  46. # Controls who can get stuff from this server.
  47. #
  48. Require all granted
  49. </Directory>

发表评论

表情:
评论列表 (有 0 条评论,399人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Mac修改文件操作权限

    今天笔者在更改某文件的时候提示权限不够,于是就产生了这篇文章。 让更多的朋友们知道遇到这种情况该怎么办。 首先我们先找到那个文件夹的所在目录。然后右键它会出现选项: 我

    相关 mac文件修改权限设置

    本地开发需要模拟数据,所以使用php,但是php文件的目录没有操作权限,每次修改都要输入密码,非常的麻烦 。所以要修改目录的权限。 1. 在目录的齿轮中点击\[显示简介\]