Mobile app version of vmapp.org
Login or Join
Ann8826881

: Sites-available inheritance 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

@Ann8826881

Posted in: #Apache2 #Configuration

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ann8826881

1 Comments

Sorted by latest first Latest Oldest Best

 

@Harper822

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme