I installed Fedora 24 and I am trying to set up Apache for virtual host.

I get a "404 Not found" when trying to access via browser.

Below are my config files and error outputs from httpd -S (files may have to much in them at this point).

SElinux has been disabled.

httpd -S output:

AH00112: Warning: DocumentRoot [/home/www/apecenergy.co.uk/public_html] does not exist
AH00112: Warning: DocumentRoot [/home/www/rangayoga.co.uk/public_html] does not exist
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server www.apecenergy.co.uk (/etc/httpd/conf.d/httpd-vhosts.conf:23)
         port 80 namevhost www.apecenergy.co.uk (/etc/httpd/conf.d/httpd-vhosts.conf:23)
                 alias www.apecenergy.co.uk
         port 80 namevhost rangayoga.co.uk (/etc/httpd/conf.d/httpd-vhosts.conf:32)
                 alias www.rangayoga.co.uk
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/home/david/www"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
Mutex authdigest-opaque: using_defaults
PidFile: "/run/httpd/httpd.pid"
User: name="apache" id=48
Group: name="apache" id=48

!!!!((( Should the document root be owned by "apache" and not "david", just noticed this now from seeing the last 2 lines)))!!!!

etc/hosts file:   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6  rangayoga.co.uk www.rangayoga.co.uk  apecenergy.co.uk www.apecenergy.co.uk


<VirtualHost *:80>
    ServerAdmin admin@apecenergy
    DocumentRoot /home/www/apecenergy.co.uk/public_html
    ServerName www.apecenergy.co.uk
    ServerAlias www.apecenergy.co.uk
    ErrorLog "/var/log/httpd/apecenergy-error_log"
    CustomLog "/var/log/httpd/apecenergy-access_log" common

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/home/www/rangayoga.co.uk/public_html"
    ServerName rangayoga.co.uk
    ServerAlias www.rangayoga.co.uk
    ErrorLog "/var/log/httpd/rangayoga.co.uk-error_log"
    CustomLog "/var/log/httpd/rangayoga.co.uk-access_log" common


etc/httpd/conf/httpd.conf (selected data, if you require full document please ask)

ServerRoot "/etc/httpd"

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of 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.
Listen 80

# Dynamic Shared Object (DSO) Support
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
# Example:
# LoadModule foo_module modules/mod_foo.so
Include conf.modules.d/*.conf

# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User apache
Group apache

# '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.

# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. [email protected]
ServerAdmin root@localhost

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
# If your host doesn't have a registered DNS name, enter its IP address here.
#ServerName www.example.com:80

# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
<Directory />
    AllowOverride none
    Require all granted

# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.

# 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 "/home/david/www"

# Relax access to content within /var/www.
<Directory "/home/david/www">
    AllowOverride None
    # Allow open access:
    Require all granted

# Further relax access to the default document root:
<Directory "/home/david/www">
    # 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.
    Options Indexes FollowSymLinks

    # 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.
    Require all granted

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
<IfModule dir_module>
    DirectoryIndex index.html

# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
<Files ".ht*">
    Require all denied

1 Answer 1


The first two lines of httpd -S output are quite explicit indicating that you didn't create the proper directory structure for (/home/www/apecenergy.co.uk/public_html and /home/www/rangayoga.co.uk/public_html).

This alone is more than enough to get a HTTP 404 error.

  • is the ".co.uk" part allowed? Commented Jul 4, 2016 at 23:04
  • That structure is quite common: /home/www/$fullDomainName/public_html Commented Jul 4, 2016 at 23:06
  • i have checked the directory and they are there as stated, each folder in turn spelt the same Commented Jul 4, 2016 at 23:11
  • Does the apache user have access to them? You can test it by temporarily giving it a shell in /etc/passwd. Commented Jul 4, 2016 at 23:24
  • Copy and paste the output of the pwd command from both of those subdirectories (the public_html ones) as well as the permissions on that folder
    – cutrightjm
    Commented Jul 5, 2016 at 0:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .