Symlinked MAMP Folder Causing 403 Forbidden

倾然丶 夕夏残阳落幕 提交于 2019-12-21 05:16:25

问题


I have a folder in my root MAMP directory, "site". I have that symlinked to a folder in ~/Documents/Dropbox/site, so whatever happens in "site" gets transferred to Dropbox.

However, when I do this, I get a 403 forbidden error when trying to view localhost/site- is this a problem because I'm using PHP and I should fix php.ini, or is this an httpd.conf problem?

In httpd.conf, I have AllowOverride set to None.

Thanks for any answers in advance.


回答1:


There's also the FollowSymlinks option in Apache, which is generally disabled by default. You can enable it by doing

Options +FollowSymlinks



回答2:


This is a bit hacky, but I had this problem before and while the solution didn't necessarily make a whole lot of sense, it worked for me:

  1. sudo su <username> to assume the user (eg, if your webserver is running as nobody, use nobody
  2. If #1 is a user whose shell is something similar to /sbin/nologin, temporarily use usermod to change their shell to something you can use, like /bin/bash, before sudoing as them
  3. Symlink as the user instead of root or whatever user this was done as previously
  4. Reset any changes made in #2

Since symlinks are by default 0777, any normal process has read access provided that the destination directory is also of sufficient permissions (0644 would be fine) - for some reason Apache gave me problems with that to. Once I created the link as the user in question, it worked like a charm. HTH!

Edit: also, this almost goes without saying, but I'm assuming you verified the link yourself via a terminal to make sure that the link is correct, right?



来源:https://stackoverflow.com/questions/5343665/symlinked-mamp-folder-causing-403-forbidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!