您无权访问此服务器上的/文件夹 - AWS EC2

时间:2014-09-16 23:41:35

标签: php apache amazon-web-services amazon-ec2

我知道有十亿个问题,但我不能让它发挥作用。

到目前为止我做了什么:

  1. 更改我的httd.conf文件,使DirectoryRoot为/home/ec2-user/folder

  2. 重启我的apache服务器。

  3. chmod -R 775 /home/ec2-user/folder

  4. 更改了我的httd.conf(此处只更改了行)

  5. ...

    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    
    #DocumentRoot "/var/www/html"
    DocumentRoot "/home/ec2-user/folder"
    
    
    #
    # Each directory to which Apache has access can be configured with respect
    # to which services and features are allowed and/or disabled in that
    # directory (and its subdirectories).
    #
    # First, we configure the "default" to be a very restrictive set of
    # features.
    #
    <Directory />
    #    Options FollowSymLinks
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
    #    Allow from all
        Require all granted
    </Directory>
    

    然后这个:

    # This should be changed to whatever you set DocumentRoot to.
    #
    
    #<Directory "/var/www/html">
    <Directory "/home/ec2-user/folder">
    #
    # 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/2.2/mod/core.html#options
    # for more information.
    #
      #  Options Indexes FollowSymLinks
    
        Options Indexes FollowSymLinks Includes ExecCGI
    #
    # 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 All
    
    #
    # Controls who can get stuff from this server.
    #
        Order allow,deny
     #   Allow from all
    Require all granted
    </Directory>
    

    然后这个:

    #
    # Listen: Allows you to bind Apache to specific IP addresses and/or
    # ports, in addition to the default. See also the <VirtualHost>
    # directive.
    #
    # Change this to Listen on specific IP addresses as shown below to
    # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
    #
    #Listen 12.34.56.78:80
    #Listen 80
    Listen 0.0.0.0:80
    

    但我仍然在/file.php上拒绝了许可。

    我错过了什么?

    编辑:我也改变了DocumentRoot。在此之前,我有一个错误的网址错误,现在我没有权限。所以,现在,网址是正确的,我只是没有为它设置正确的权限。

1 个答案:

答案 0 :(得分:-1)

我没有做与上面不同的事情 - 但是在重新启动我的Apache并退出我的AWS多次之后 - 然后它神奇地工作了。通过执行上述步骤并检查日志中的错误,您应该将其修复。