简体   繁体   English

尝试访问服务器上的“ /”时,Apache给我403错误

[英]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 当我尝试将Web根目录路径更改为任何其他文件夹时,它给我403错误(禁止),默认路径是/Library/WebServer/Documents ,但是由于这对我来说很烦人,所以我也更改了它/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) 我从/Library/WebServer/Documents获得了权限,方法是右键单击并选择“ Get infohttp://i.imgur.com/f21D7z0.png看起来像什么)

So I changed it to be the exact same for /Users/Xero/WebServer . 所以我将其更改为与/Users/Xero/WebServer完全相同。 But it give me a 403 error still. 但是它仍然给我一个403错误。



Attempt to fix 尝试修复

So, I looked it up on Google, and I tried these solutions to fix my problem: 因此,我在Google上进行了搜索,并尝试了以下解决方案来解决我的问题:

http://www.cyberciti.biz/faq/apache-403-forbidden-error-and-solution/ 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. 记住,我在OS X Snow Leopard上使用的是预安装的Apache。 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) 而且,我的虚拟主机不是本地主机,因此不是hosts文件问题或hosts文件问题(它是由DNS托管的,而IP作为备份托管的,两者都不起作用)

My Virtual Hosts: 我的虚拟主机:

User _www
Group _www

Also, I have my httpd.conf User and Group setup like this: 另外,我的httpd.conf UserGroup设置如下:

 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. 因此,我将路径固定为文档的路径,但仍然给我相同的错误403。
  2. I checked my FireWall settings and it's off. 我检查了FireWall设置,然后将其关闭。 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. 我在“ wrks.tk” VirtualHost中编辑了“ DirectoryIndex Home.php Home.html”的副本,但是仍然遇到相同的错误。 (See Other Notes) (请参阅其他说明)
  4. Added more too Other Notes. 也添加了其他注释。
  5. Fixed directory, but still didn't fix problem. 修复了目录,但仍然没有解决问题。
  6. Added another to Answer Responses. 在回答响应中添加了另一个。
  7. Tried a computer restart, did not work. 尝试重新启动计算机,无法正常工作。
  8. I put a `index.html` in the folder, still got the same 403 error, I tried accessing `/index.html`, still, 403. 我在文件夹中放入了一个“ index.html”,仍然出现相同的403错误,我尝试访问“ /index.html”,仍然是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. 如果您使用的是Apache,请查看sites-enabled sites-available文件夹和sites-available文件夹。


Change the bottom part of your httpd.conf file to: 将您的httpd.conf文件的底部更改为:

#
# 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: 制作一个新文件index.html并将以下内容放入其中:

<!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. 然后将index.html文件放入空目录。


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: /etc/apache2/users/创建一个名为yourusername.conf (您的/etc/apache2/users/名是帐户的短名称,例如hulu –通常是/ Users中您的主文件夹的名称),其内容如下:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 服务器/ Apache从1.3升级到2.0强制HTTPS和WWW时出现错误 - Server/Apache upgrade from 1.3 to 2.0 gives me an error when forcing HTTPS and WWW Facebook在尝试生成代码时给我错误 - Facebook gives me error when trying to generate code Laravel 4-尝试访问css / js文件时出现403权限错误 - Laravel 4 - 403 Permissions error when trying to access css/js files 禁止访问! 尝试运行php文件时出现错误403 - Access forbidden! Error 403 when trying to run a php file 尝试访问 cusotm 路由时收到 403 Forbidden 错误消息 - Getting 403 Forbidden error message when trying to access a cusotm route 尝试创建子用户时 sendgrid 错误“403 访问被禁止” - sendgrid error "403 access forbidden" when trying to create sub user 在开发服务器上设置时,cake php给我错误 - cake php gives me error when setting up on development server Pinterest API-在Dreamhost服务器上请求访问令牌时出现403错误 - Pinterest API - 403 error when requesting access token on Dreamhost server 尝试使用https连接时,在xampp linux中更改Web根目录将给出错误403 - changing web root in xampp linux gives error 403 when trying to connect using https Apache上的cURL显示..“禁止访问! 错误403” - cURL on Apache showing .. “Access forbidden! Error 403”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM