Home  >  Q&A  >  body text

Access to the httpd - apache virtual directory is prohibited. Where is the error (conf file attached)?

Alias /hc/ "/home/bitnami/hanchuan/htdoc"
Alias /hc "/home/bitnami/hanchuan/htdoc"

<Directory "/home/bitnami/hanchuan/htdoc">
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Visit http://alangs.info/hc or http://alangs.info/hc/index.php
They all reported the error of not having permission to access.
In fact, /home/bitnami/hanchuan/htdoc/index.php exists.
Where is the error?

The problem is solved.
Put: Order allow,deny
Change to: Order deny,allow
You can access it.
The strange thing is that other directories can be accessed without writing them like this.

黄舟黄舟2713 days ago797

reply all(6)I'll reply

  • 高洛峰

    高洛峰2017-05-16 17:07:07

    @alang You should also start with the logs. You have already said that you have read the logs, but have you adjusted the LogLevel? The default level may not be enough.

    -------------------------------------------------

    Order order see:

    The Order command controls the default access status and the order in which the Allow and Deny commands take effect. The Ordering value range is one of the following examples:

    Deny, Allow The
    Deny directive is evaluated before the Allow directive. All access is allowed by default. Any client that does not match the Deny directive or matches the Allow directive is allowed access.
    Allow,Deny
    Allow directive is evaluated before Deny directive. All access is denied by default. Any client that does not match the Allow directive or matches the Deny directive will be denied access.
    … …

    I saw this sentence in the manual:

    Note: If there is a suffix "/" in the url-path, the server requires a suffix "/" to extend this alias. In other words, "Alias ​​/icons/ /usr/local/apache/icons/" cannot alias "/icons".

    Put
    Alias ​​/hc/ "/home/bitnami/hanchuan/htdoc"

    Try removing it?

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 17:07:07

    chmod 755 /home/bitnami/hanchuan/htdoc Try it, it may be that this directory does not have read and write permissions for other users

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 17:07:07

    ls -l Check the properties and permissions of /home/bitnami/hanchuan/htdoc, and check the group and owner, because there may be problems in the home directory!

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 17:07:07

    Please see the error.log for these problems, it will tell you everything

    reply
    0
  • ringa_lee

    ringa_lee2017-05-16 17:07:07

    Check if it’s a problem with selinux and fix it

    setenforce 0

    Try again

    reply
    0
  • 高洛峰

    高洛峰2017-05-16 17:07:07

    Problem solved.
    Put: Order allow, deny
    Change to: Order deny,allow
    You can access it.
    The strange thing is that other directories can be accessed without writing them in this way.

    reply
    0
  • Cancelreply