Php Apache虚拟主机,禁止访问。使用XAMPPSX
我在浏览器中转到“mytest.dev”,出现以下错误:Php Apache虚拟主机,禁止访问。使用XAMPPSX,php,macos,apache,xampp,virtualhost,Php,Macos,Apache,Xampp,Virtualhost,我在浏览器中转到“mytest.dev”,出现以下错误: Access forbidden! You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. If you think this is a server error, please contact the webmaster. Er
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
mytest.dev
Apache/2.4.18 (Unix) OpenSSL/1.0.2g PHP/5.6.19 mod_perl/2.0.8-dev Perl/v5.16.3
在我的/Applications/XAMPP/etc/httpd.conf文件中,我有以下未注释的行,我的指令内容如下所示:
Include etc/extra/httpd-vhosts.conf
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/myTest"
ServerName mytest.dev
</VirtualHost>
但是,上面的行在根目录/etc中,而不是在/Applications/XAMPP/etc中。在我的/XAMPP/etc目录中没有hosts文件
最后,因为指令中我的DocumentRoot是这样的:“/Applications/XAMPP/xamppfiles/htdocs/myTest”我有一个index.php文件,其中有一个hello-world脚本,在myTest目录中:
...html stuff...
<?php echo '<p>Hello World</p>'; ?>
... html stuff...
根目录中的所有目录都必须是可执行的,以便您或web服务器能够在读取它们之前遍历它们。以下命令应设置正确的权限:
sudo chmod +X /Applications/XAMPP/xamppfiles/htdocs
sudo chmod +X /Applications/XAMPP/xamppfiles
sudo chmod +X /Applications/XAMPP
sudo chmod +X /Applications
sudo chmod +X /
然后确保您的web文件可读且可执行
sudo chmod -R +Xr /Applications/XAMPP/xamppfiles/htdocs/myTest
根目录中的所有目录都必须是可执行的,以便您或web服务器能够在读取它们之前遍历它们。以下命令应设置正确的权限:
sudo chmod +X /Applications/XAMPP/xamppfiles/htdocs
sudo chmod +X /Applications/XAMPP/xamppfiles
sudo chmod +X /Applications/XAMPP
sudo chmod +X /Applications
sudo chmod +X /
然后确保您的web文件可读且可执行
sudo chmod -R +Xr /Applications/XAMPP/xamppfiles/htdocs/myTest
你能点击
mytest.dev/index.php吗?
?不,我不能得到同样的消息,但我想我造成了一个问题,很可能是sudo chmod 644/Applications/XAMPP/xamppfiles/htdocs/现在我甚至无法将cd放入我的htdocs目录中。。我也有问题,只是去localhost/rockpaperscissors(另一个应用程序,放在我的htdocs里面,在晚上运行得很好)你能点击mytest.dev/index.php
?不,我不能得到同样的消息,但我想我造成了一个问题,最有可能的是sudo chmod 644/Applications/XAMPP/xamppfiles/htdocs/现在我甚至无法将cd刻录到我的htdocs目录中。。我也有问题,只是去localhost/rockpaperscissors(另一个应用程序,放在我的htdocs中,在晚上运行良好)