403 Forbidden Error on MAMP

无人久伴 提交于 2019-12-11 10:27:27

问题


I try to run my local applications on MAMP PRO. Since now i run MAMP and everything works fine. Now i've changed to MAMP PRO because of the possibilities to generate more hosts and send email from local applications.

Now i have the problem that i can't access files in a directory.

I have checked indexes under Hosts->Extended which should solve this problem.
But it doesn't. I've found many articles but not anyone that solves my problem. I'm also not a specialist on server, but i think there must be a easy solution even in MAMP it works.

I've read something over Web-sharing but this was not clear described enough.

  • MACOSX: 10.11.2
  • MAMP PRO: 3.5

One failure in the log was:

"Permission denied: file permissions deny server access: /folder/file.js"

But where i can change it generally.

Thanks for your Help. I'm very confused.

codeFragment


回答1:


Sounds like a permission problem. Set the parent folder to "read only" for all and assign it to all folders/files below.

Greetings,

Peter




回答2:


This worked for me.

  1. Create an index file in the directory, by default Apache is looking for such a file
  2. If you want to access the directory (the list of your files or folders in the directory), just go in Mamp Pro to Hosts >> Advanced and check Indexes.

So simple, no need to go configure any file.




回答3:


This case is occur when you run Mamp with the Server Nginx and nginx server needed configuration of each working folder/directory. for the nginx configuration you can go in nginx.conf file on path

C:\MAMP\conf\nginx\nginx.conf

and write this script.

http {
    .....
    server {


    location ~* /test(.*)$ {
    root             C:/MAMP/htdocs/test;
        index            index.php;

        location ~ \.php$ {
            try_files        $uri =404;
            fastcgi_pass     127.0.0.1:9100;
            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include          fastcgi_params;
        }
    }

  }
}

note: in this script test is my working directory. you can replace this name.




回答4:


Whenever you are setting up a new server on a Mac, whether it be MAMP, MAMP PRO or just straightforward Nginx/Apache, always set the right permissions on the root folder. Permissions are used for security reasons, not a bad thing in any way although it adds layers to get things done good or bad. Nginx/Apache usually uses _www to read and write on your folder. So you must grant _www access access.

To do this for example on a folder located at /MacHD/Sites...

  1. open up a console
  2. sudo chown -R _www Sites
    sudo chmod -R g+w Sites```
    
  3. restart your server

References: - https://ss64.com/osx/chmod.html - https://ss64.com/osx/chown.html



来源:https://stackoverflow.com/questions/34650562/403-forbidden-error-on-mamp

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