dousi6192 2015-09-08 02:52
浏览 32

新手更改目录权限后Apache权限错误

I've read through every post I can find on the error message:
You don't have permission to access / on this server.

And I am not even sure what info to include. Definitely a newbie. Here's what I know. I am running Apache/2.4.16 on a Mac OSX Yosemite. At one point http://localhost returned "It works!". I then went to /etc/apache2, opened the file httpd.conf and removed the # (using MacRabbit Espresso) from the following lines:
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so

I restarted apachectl. Everything still seemed to be working fine at that point. (Although I did not retest localhost).

Here's where the problem seemed to have started. I created a new file info.php. I placed it in "/Library/WebServer/Documents". I then tried "http://localhost/info.php". That's when the permission errors started showing up. And that is when my evil hacker side took over. I used Finder to change permissions in several subdirectories, basically adding Read & Write permissions to me. The one oddity is that the httpd.conf file has permissions for me, wheel, and everyone. But no permissions for "system." (No clue as to whether or not that matters.)

End result: I got the permissions error I wrote about above.

So where do I go from here?

  • 写回答

1条回答 默认 最新

  • douchu2823 2015-09-08 04:56
    关注

    Be careful changing permissions on random files as you can do damage to your system or create security holes in your machine.

    Apache on OSX uses /Library/WebServer/Documents/ as the document root and Apache has a special user for running the webserver (which I believe on OSX is _www).

    What I would suggest is following the instructions on the accepted answer in this question (Correct owner/group/permissions for Apache 2 site files/folders under Mac OS X?) which gives a very good answer, otherwise this guide here goes through not only setting up Apache, but configuring it to have user-level document roots.

    If you feel confident in working in the command line yourself, the answer is to make sure that _www is allowed to read and execute files contained in the document root and is the owner of the document root.

    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题