I don't agree with Janka's answer. You can't just pick any Fugenlaut that sounds good to you. In most cases there is only one correct version. In the case of Geschichte and Hausaufgaben it is true that there are two possibilities:
Geschichtehausaufgaben
and
Geschichtshausaufgaben
as mentioned by Janka. I have heard both. Personally, I prefer the latter. Also when you google Geschichtehausaufgaben it asks: "Did you mean Geschichtshausaufgaben."
But as I said, in most cases there is one possibility only. Haus (house) and Tür (door) can only be connected as Haustür (front door) although Hausetür or Hausentür are easy to pronounce as well. Steichenholz would even be easier to say than the correct form Streichholz (match) (the one to make fire) (compound of streichen - to strike and Holz - wood). But only the latter is correct.
Unfortunately, I'm not firm enough in grammar to tell you what rules apply or if there are any at all. But I am pretty sure that it is determined by the first word. If I think about a word, I have a clear preference how to connect it with another word even if I haven't thought about a second word or when the resulting word would be complete nonsense. E.g. if I want to build a word with Tisch (table) in front, I already know that I will use the Nullfuge no matter what the second word will be.
On the German Wikipedia page to Fugenlaut it is stated that two studies have shown that the Nullfuge is used in over 70% of all examined words. So if you're not sure what to use, the Nullfuge should be a good guess.