简体   繁体   中英

Apache Gives me 403 Error when trying to access “/” on server

When I try to change the web root path to any other folder it give me a 403 error (Forbidden), The default path is /Library/WebServer/Documents , but since this rather annoying for me, I changed it too /Users/Xero/WebServer

Permissions

I got the permissions from /Library/WebServer/Documents by right clicking and selecting Get info ( http://i.imgur.com/f21D7z0.png What it looks like)

So I changed it to be the exact same for /Users/Xero/WebServer . But it give me a 403 error still.



Attempt to fix

So, I looked it up on Google, and I tried these solutions to fix my problem:

http://www.cyberciti.biz/faq/apache-403-forbidden-error-and-solution/

Error message "Forbidden You don't have permission to access / on this server" (Stack Overflow)

But they didn't help.



Other Notes

Remember I'm using the preinstalled Apache on OS X Snow leopard. And, my virtual host isn't local, so it's not part or the hosts file issue (It's hosted off my DNS, and my IP as a backup, neither work)

My Virtual Hosts:

User _www
Group _www

Also, I have my httpd.conf User and Group setup like this:

 User _www Group _www 



Responses to Answers



Edits

  1. So, I fixed the path's to the document's, but it still giving me the same error, 403.
  2. I checked my FireWall settings and it's off. I also checked my `Sharing Preferences`, `File Sharing` and `Web Sharing` are on.
  3. I edited the duplicate of `DirectoryIndex Home.php Home.html` in the `wrks.tk` VirtualHost, but still, I'm getting the same error. (See Other Notes)
  4. Fixed directory, but still didn't fix problem.
  5. Added another to Answer Responses.
  6. Tried a computer restart, did not work.
  7. I put a `index.html` in the folder, still got the same 403 error, I tried accessing `/index.html`, still, 403.

What file exactly are you getting all of this from?

<VirtualHost *:80>                                      ( Edited 2 )
DocumentRoot "/Users/Xero/WebServer" 
</VirtualHost>

<VirtualHost *:80>
    Options Indexes FollowSymLinks Includes ExecCGI
    DocumentRoot "/Users/Xero/WebServer"
    ServerName wrks.tk
    ErrorLog "/Logs/Workarea/wrks-err"
    CustomLog "/Logs/Workarea/wrks-acc" common
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
    <Directory "/Users/Xero/WebServer">
            Options +Indexes FollowSymLinks +ExecCGI
            AllowOverride AuthConfig FileInfo
            Order allow,deny
            Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/Users/Xero/WebServer"
    ServerName 209.169.203.53
    ErrorLog "/Logs/Workarea/ip"
    CustomLog "/Logs/Workarea/ip-acc" common
    <Directory "/Users/Xero/WebServer">
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>
</VirtualHost>

There are more than one file for those settings. If you have apache, then take a look in the sites-enabled and sites-available folders.


Change the bottom part of your httpd.conf file to:

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Require all granted

Make a new file index.html and put the following in it:

<!DOCTYPE html>
<html>
<body>

<h1>It works!</h1>

<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>

</body>
</html>

Then place the index.html file into the empty directory.


create a file in /etc/apache2/users/ called yourusername.conf (yourusername being the account short name, eg hulu – it's usually the name of your home folder in /Users) with the following contents:

<Directory "/Users/yourusername/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM