osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[users@httpd] Apache site conf Include not working


Hi,

 

I am using Apache 2.4.18 on ubuntu x64.

 

I have a large site config with many rewrites and want to split them off into multiple conf files using Include. They all work perfectly in one single file

 

When I add an include inside a VirtualHost, the included file is not used.

The syntax is correct and the path is valid as apachectl -t rejects it otherwise.

Apache2 restarts fine with the new config, but appears to just ignore the Includes.

Here is an example of mysite.conf – all names & paths changed.

 

Define SrvNm myserver.org

Define UsrNm myuser

 

<VirtualHost *:80>

        ServerName ${SrvNm}

        ServerAlias ${SrvNm} www.${SrvNm}

        ServerAdmin webmaster@localhost

        DocumentRoot /home/${UsrNm}/mysoftware/

        ErrorDocument 404 /404.php

 

       Include "includes/myconf80.conf"

</VirtualHost>

 

 

myconf80.conf contains

 

        <Directory /home/${UsrNm}/mysoftware/>

                Options none

                AllowOverride none

                Require all granted

 

                <Files ~ "\.txt$">

                        Options None

                        Require all denied

                </Files>

 

                # Free robots.txt

                <Files robots.txt>

                        Options None

                        Require all granted

                </Files>

 

        </Directory>

 

This code works if within mysite.conf, but is ignored as an include. I cannot find out why after searching the web everything I find says it should work, even where conf files have been included on multiple vhosts where their code is common.

 

Can anyone help suggest what might be wrong to cause them to be ignored. The syntax, paths & names are correct and the code moved to be within in them has worked for years already in the single site conf file.

 

Thanks

 

Ian