I'm setting up a subdomain for mobile content that will be hosted on the same server but in a separate root directory (/www/main and /www/mobile).

I'm trying to configure the sites-available .conf files for each, and I started to wonder something. What settings can be put in default.conf that will be automatically inherited by my main.conf and mobile.conf files? Is this even possible?

For example, if I define ErrorLog and ServerAdmin settings in default.conf, will they be inherited by the other two files?

1 Answer 1


Apache's default file is httpd.conf and from a new installation, this can be found in the conf subfolder from where apache was installed.

What you're really looking for is the "Include" keyword which imports whatever configuration you want into the section that keyword is in.

So if you're defining a special hostname like m.example.com and you want configuration in mobile.conf and sites-available.conf to apply to m.example.com then you look for a virtual host tag with m.example.com and in it add:

Include /path/to/mobile.conf
Include /path/to/sites-available.conf

And also, the order you specify the includes determines which configuration is applied first. The first file specified is loaded first.

If you need to apply the config of default.conf to mobile.conf and main.conf, then for each conf file, you need to add:

Include /path/to/default.conf

replace /path/to/ with the full path to the configuration files so that they load. If you specify invalid files or files that are not found, then you'll get a 500 internal server error when trying to access any webpage on your server.

After making changes to the configuration, you'll need to restart apache.

  • Exactly what I needed to know. Thanks so much. Is the include path based off of the root?
    – Adam
    Commented May 18, 2015 at 19:22
  • the way I showed you, yes. In Linux, Root folder always starts with a forward slash. Commented May 18, 2015 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.