当我尝试将Web根路径更改为任何其他文件夹时,它会给我403错误(禁止),默认路径为/Library/WebServer/Documents
,但由于这对我来说很烦人,我也改变了它{{ 1}}
/Users/Xero/WebServer
(http://i.imgur.com/f21D7z0.png看起来像是什么)来获得/Library/WebServer/Documents
的权限
因此我将其更改为Get info
的完全相同。但它仍然给我403错误。
所以,我在谷歌上查了一下,我尝试了这些解决方案来解决我的问题:
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)
但他们没有帮助。
/Users/Xero/WebServer
文件问题(它托管在我的DNS上,我的IP作为备份,也不起作用)
我的虚拟主机:
hosts
另外,我的httpd.conf <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>
和User
设置如下:
Group
答案 0 :(得分:0)
你究竟从这个文件中得到了什么文件?
<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>
这些设置有多个文件。如果您有Apache,请查看sites-enabled
和sites-available
文件夹。
将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
制作一个新文件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>
然后将index.html
文件放入空目录。
在名为/etc/apache2/users/
的{{1}}中创建一个文件(您的用户名是帐户短名称,例如hulu - 通常是/ Users中您的主文件夹的名称),其中包含以下内容:
yourusername.conf