gpt4 book ai didi

apache - apache 虚拟主机设置中的禁止错误

转载 作者:太空宇宙 更新时间:2023-11-03 16:55:48 24 4
gpt4 key购买 nike

您好,我一直在浏览互联网文章论坛来解决我的问题,但到目前为止都无济于事。我正在尝试在本地主机上为我的 FuelPHP 开发设置一个 Apache 虚拟主机,但我一直收到错误 403 消息的抨击。这是我当前的设置。

#/etc/apache2/sites-enabled/000-default
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot "/home/supercomputer/Desktop/PHP/fuelProject/public"
ServerName localhost.home
<Directory "/home/supercomputer/Desktop/PHP/fuelProject/public" >
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>

我已将我的 Docroot 指向我的 fuelProject 中的公用文件夹。此外,为了确保 Apache 可以访问服务器文件,我递归地设置了所有文件的读取、写入和执行权限,以确保 100% 安全。关于其他可能出错的任何线索?

PS: 我正在运行 ubuntu raring (13.04)

PSS:我正在尝试访问 localhost.home 和 localhost.home/index.php。重新启动服务器时,我还会收到以下警告

* Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Fri May 03 15:46:58 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Fri May 03 15:46:59 2013] [warn] NameVirtualHost *:80 has no VirtualHosts

最佳答案

这是为 fuelphp 应用程序或任何其他 php 应用程序添加 Vhost 的正确方法

<VirtualHost *:80>
ServerName localhost.home
DocumentRoot /home/supercomputer/Desktop/PHP/fuelProject/public
ServerAdmin webmaster@localhost
<Directory /home/supercomputer/Desktop/PHP/fuelProject/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

而且下面这行不是必需的我不知道你为什么要添加

NameVirtualHost *:80

完成上述所有操作后,将主机条目添加到您的计算机以执行此操作

sudo vi /etc/hosts

添加一个虚拟主机的条目

127.0.0.1  localhost.home

做完这些之后

通过运行重新启动 Apache

sudo /etc/init.d/apache2 restart 

然后加载http://localhost.home在您的浏览器中,您应该能够看到您的网站正在运行。

如果你仍然得到禁止的错误。你需要给你的整个应用程序文件夹权限

按照运行这些命令来执行此操作

sudo chown -R www-data:www-data /home/supercomputer/Desktop/PHP

sudo chmod -R 775 /home/supercomputer/Desktop/PHP

最后将自己添加到www-data组

sudo adduser yourUserName www-data

关于apache - apache 虚拟主机设置中的禁止错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16368598/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com