Is it safe to stack Mac minis on top of each other?
In How to position your Mac mini, Apple, perhaps being overcautious, say not to:
Don't put anything on top of your Mac mini or stack Mac minis on top of each other either. If your Mac mini is configured with AirPort or Bluetooth, you could hamper the signal strength since the antennas are located in the top of the computer.
If you only connect with Ethernet the connectivity issues are moot and even if you do use a Bluetooth keyboard or Wi-Fi you may well find it it works well enough for your situation.
Although not mentioned in the support article the Mac mini dissipates a large amount of heat through the case and insufficient ventilation will cause an increased temperature particularly in the lower mini if the hot air is trapped and can not escape.
It will certainly not harm anything to test stacking them as they will shut down if they get dangerously hot. Prior to a temperature related shutdown however you may find reduced CPU performance as there is less thermal head-room to Turbo the CPU clock, and it may also possibly shorten the lifetime of components due to running near the upper end of their safe temperature range for extended periods.
So while it can't hurt to try you should watch the temperatures. As @IconDemon mentions in their answer with sufficient ventilation this will not be an issue. As they mentioned in their answer ventilation may be improved by putting rubber feet or other spacers to increase the size of the air gap between them.
If you try it and find it is causing a problem either with heat (and thus fan noise) or connectivity, you could perhaps put them both on their sides with a gap between. As mentioned in the support doc above and in this question Is it safe to run a Mac Mini (i5) on its side? you can safely do this.
This vertical configuration would allow air heated by the cases to easily rise and escape rather than be trapped under the mini above.
I use an IKEA 7-inch trivet underneath my Mac mini to improve ventilation. That might help between stacked Mac minis :