Apache show me "Access forbidden!"

Hello.
I installed “Apache/2.4.16” and when I want browse “localhost” then it show me "Access forbidden!. Which part of “httpd.conf” must be changed:


<Directory />
    Options None
    AllowOverride None
    <IfModule !mod_access_compat.c>
        Require all denied
    </IfModule>
    <IfModule mod_access_compat.c>
        Order deny,allow
       #Deny from all
        Allow from all
    </IfModule>
</Directory>

Thank you.

NOTE:
In post #10 below the OP states that he uses in fact
Apache/2.4.23 (Linux/SUSE)

Usually /etc/apache2/httpd.conf has a comment for the section you’ve mentioned:


# forbid access to the entire filesystem by default
<Directory />
    Options None
    AllowOverride None
    <IfModule !mod_access_compat.c>
        Require all denied
    </IfModule>
    <IfModule mod_access_compat.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Directory>

Within /etc/apache2/httpd.conf there’s usually the following section:


### 'Main' server configuration #############################################
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
Include /etc/apache2/default-server.conf

If you look in /etc/apache2/default-server.conf you should find:


#
# Configure the DocumentRoot
#
<Directory "/srv/www/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/2.4/mod/core.html#options
        # for more information.
        # NOTE: For directories where RewriteRule is used, FollowSymLinks
        # or SymLinksIfOwnerMatch needs to be set in Options directive.
        Options None
        # 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
        # Controls who can get stuff from this server.
        <IfModule !mod_access_compat.c>
                Require all granted
        </IfModule>
        <IfModule mod_access_compat.c>
                Order allow,deny
                Allow from all
        </IfModule>
</Directory>

The following points have to be checked:

  1. The permissions on the directory /srv/
  2. The permissions on the directory /srv/www/
  3. The permissions on the directory /srv/www/htdocs/
  4. The permissions on the files within /srv/www/htdocs/

In all cases, there has to be read access for “world” (also known as “other”) …

When yo use one of the unsupported versions of openSUSE (you choose OTHER VERSION), then please at least explain which version that is. It makes it easier to understand what sort of environment you use for your potential helpers.

Also,
Most people configure their websites to be bound to their external network interface, not localhost (127.0.0.1).

TSU

Yes, I’m also more than a little bit worried by the Apache version the thread’s originator has mentioned …

Also, the thread’s originator doesn’t mention which Operating System is being used to run the Apache server …

Thank you.
If I want to see Apache test page then which configure must be change?

Several people have asked you several questions (mainly about the versions you use).

Someone has asked you to check several things (e.g. permissions).

When you do not give any answers to them or e.g. show what those permissions are, you take the risk of not getting any more advice.

Oh sorry. The information are:


> ls -l /srv/
total 0
drwxr-xr-x 1 root root  0 May 10  2017 ftp
drwxr-xr-x 1 svn  svn   0 Aug 11  2017 svn
drwxr-xr-x 1 root root 26 May 10  2017 www


> ls -l /srv/www/
total 0
drwxr-xr-x 1 root root   0 May 10  2017 cgi-bin
drwxr-xr-x 1 root root 626 May 25 12:22 htdocs


> ls -l /srv/www/htdocs/
total 1192
drwxr-xr-x 1 root root    112 May 25 12:22 app
-rw-r--r-- 1 root root    234 Mar 15 09:42 auth.json.sample
drwxr-xr-x 1 root root     32 May 25 12:22 bin
-rw-r--r-- 1 root root 434981 Mar 15 09:42 CHANGELOG.md
-rw-r--r-- 1 root root   2257 Mar 15 09:38 composer.json
-rw-r--r-- 1 root root 714229 Mar 15 09:42 composer.lock
-rw-r--r-- 1 root root    650 Mar 15 09:42 COPYING.txt
drwxr-xr-x 1 root root     50 May 25 12:22 dev
drwxr-xr-x 1 root root     18 May 25 12:22 generated
-rw-r--r-- 1 root root     57 Mar 15 09:42 grunt-config.json.sample
-rw-r--r-- 1 root root   2994 Mar 15 09:42 Gruntfile.js.sample
-rw-r--r-- 1 root root   1370 Mar 15 09:42 index.php
drwxr-xr-x 1 root root     40 May 25 12:22 lib
-rw-r--r-- 1 root root  10376 Mar 15 09:42 LICENSE_AFL.txt
-rw-r--r-- 1 root root  10364 Mar 15 09:42 LICENSE.txt
-rw-r--r-- 1 root root   5625 Mar 15 09:42 nginx.conf.sample
-rw-r--r-- 1 root root   1416 Mar 15 09:42 package.json.sample
-rw-r--r-- 1 root root     68 May 22 15:23 php.php
drwxr-xr-x 1 root root     56 May 25 12:22 phpserver
drwxr-xr-x 1 root root    176 May 25 12:22 pub
drwxr-xr-x 1 root root    106 May 25 12:22 setup
drwxr-xr-x 1 root root    178 May 25 12:22 update
drwxr-xr-x 1 root root     40 May 25 12:22 var
drwxr-xr-x 1 root root   1266 May 25 12:22 vendor

Thanks, that is something.

But first and foremost people have aksed you (in post #3 and post #5) what version of openSUSE you use (because you said OTHER VERSION, thus we only know it is not a supported version, but we want to know which one) and where you got that Apache 2.4.16 from (because it is not in any openSUSE repo).

I’m using OpenSUSE 42.3 and I installed it by “zypper”:


> sudo httpd -v
Server version: Apache/2.4.23 (Linux/SUSE)
Server built:   2019-04-04 14:59:07.000000000 +0000

I changed the prefix of this thread to: 42.3 and I added a note to the first post above that in fact the version is Apache/2.4.23 (Linux/SUSE).

I hope we now can start anew with trying to understand the problem and help the OP.

Thank you.
I want to install Magento CMS and as you see, I copied Magento files in “htdocs” directory.

Hi
In you first post you need to remove the # from the Order deny,allow, this needs to be this way to forbid access to / In your post you omitted the comment;


# forbid access to the entire filesystem by default

The file you need to modify is /etc/apache2/default-server.conf but since the files you installed are php related, then I would think php needs to be active.

I you pop a test html file in there called index.html and see if you can browse to that;

http://localhost/index.html

Remove “#” ? Which part is you mean?

Hi
You posted;

<Directory />
   Options None
    AllowOverride None
    <IfModule !mod_access_compat.c>
        Require all denied
    </IfModule>
    <IfModule mod_access_compat.c>
        Order deny,allow
       #Deny from all   <== Remove the # here
        Allow from all
    </IfModule>
</Directory>

Apart from the fact that, the thread’s originator commented out the configuration parameter which prevents the system’s entire directory structure from being presented via the Apache Web Server, I suspect that, “hack3rcon” needs to concentrate on the permissions in the “DocumentRoot” section of the configuration file ‘/etc/apache2/default-server.conf’ …