0

After (or rather, during a migration between web hosts because I want to keep root on my VPS) I was gently informed that my homepage was "i tried to open the site, but it opened an index site, not a normal website". I went to see what the visitor meant, and it was an autogenerated index page, in /var/www, with an "html" folder offering Debian's elaborate "It worked!" page.

I went through 000-default.conf, and made sure it specified a DocumentRoot of "/home/cjsh/mirror". Restarted. No dice. I edited a couple of other files. No dice. I globally replaced "/var/www" with "/home/cjsh/mirror". Now it displays the correct page. However, another portion is that I want to redirect HTTP to HTTPS. Presently my site serves both; I'd like http://cjshayward.com to redirect to https://cjshayward.com, which 000-default.conf should do, but again it appears not to be consulted first.

I have a few dozen conf files; all but ssl-default.conf begin with \d\d\d in ascending order.

How can I either find out what files are loaded first, or tell Apache that I want the files to be loaded in e.g. lexicographic order?

Christos Hayward
  • 1,152
  • 3
  • 15
  • 35

1 Answers1

1

As far as I know the main httpd.conf is parsed sequentially from top to bottom with one directive per line.

The files matching an Include directive are parsed sequentially in lexicographical order before proceeding to the next directive following that Include directive.
Nested Include directives are allowed, I.e. a file loaded resulting an Include directive may also use Include directives :)

In addition the chapter on how directives and sections are merged is useful too.

A quick listing of how virtual hosts are processed is displayed with apachectl -S

Debian likes each virtual host in its own file in the sites-available sub directory and then using a2enable or e2ensite to set up a symlink to that include files from the sites-enabled directory which gets Included. See Purpose of debian "sites-available" and "sites-enabled" dirs

Includes are pretty deterministic but you don't have to rely on them, simply managing a httpd.conf manually works too.

HBruijn
  • 72,524
  • 21
  • 127
  • 192