首页 文章

Ubuntu 10.04上的虚拟主机 . - 访问禁止错误403

提问于
浏览
1

操作系统:Ubuntu 10.04 LTS

在/ opt中下载并安装了Linux 1.8.1的Xampp

当我去localhost时,我得到标准的xampp启动页面,每个工作,除了phpmyadmin,我通过添加“required all Granted”行添加到extra / httpd-xampp.conf来修复

# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
    AllowOverride AuthConfig Limit
    Order allow,Deny
    Allow from all
#cahg 
    Require all granted
</Directory>

我想开发多个站点,所以我使用我认为的标准方法设置了虚拟主机 .

  • 在我的httpd.conf文件中包含extra / httpd-vhosts.conf

  • 在extra / httpd-vhosts.conf文件中添加了一个虚拟主机容器 . 3.将以下内容添加到/ etc / hosts文件中

127.0.1.1 site1

我必须完成第一部分,因为它正在工作,但当我导航到'site 1'时,我在Web浏览器中收到以下错误

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

site1
Apache/2.4.3 (Unix) OpenSSL/1.0.1c PHP/5.4.7

我的ErrorLog中出现此错误

[Fri Nov 16 17:14:22.481075 2012] [core:error] [pid 14465] (13)Permission denied: [client 127.0.1.1:46687] AH00035: access to / denied (filesystem path '/home/andrew/websites/site1') because search permissions are missing on a component of the path

我尝试过的解决方案是使用/ home / andrew / websites / site as和attribute将此Directory块添加到目录标记中的httpd-vhosts.conf文件中 .

Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted

没有完全理解它的作用,因为它是我发现的解决方案,并在httpd.conf中声明了 "You must explicitly permit access to web content directories in other <Directory> blocks below."

我的问题是:允许apache访问各种虚拟主机的文件的最佳方法是什么?注意:在httpd.conf中,user是nobody,group设置为nogroup .

1 回答

  • 1

    首先将用户nobody更改为httpd.conf中的ubuntu用户名

    然后在httpd.conf结束时:

    # XAMPP
    Include etc/extra/httpd-xampp.conf
    

    第二,确保您的虚拟文件夹属于您的用户名(如果我的内存有效,您将不得不更改phpmyadmin的所有权)

    然后在httpd-xampp.conf中创建别名:

    Alias /phpmyadmin "/opt/lampp/phpmyadmin"
    Alias /youralias "/path/to/folder"
    

    然后在同一个httpd-xampp.conf中允许目录:

    <Directory "/path/to/folder">
      AllowOverride AuthConfig Limit
      Order allow,deny
      Allow from all
      Require all granted
    </Directory>
    

    再见403

相关问题