[英]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
/Library/WebServer/Documents
by right clicking and selecting Get info
( http://i.imgur.com/f21D7z0.png What it looks like)
/Library/WebServer/Documents
获得了权限,方法是右键单击并选择“ Get info
( http://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错误。
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. 但是他们没有帮助。
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
User
和Group
设置如下:
User _www Group _www
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.