Inside an enclosure is good, check the manufacturer's requirements though as adequate cooling is essential.
Unless your VFD is really shoddy the majority of EMI is carried through wiring, not the air, although proximity will mean short cable runs and may require a filter on each mains equipment input in the box and shielded cable from the VFD to the motor is advisable.
Outside is fine though, I've run a benchtop CNC mill for about 7 years with the VFD mounted to a bracket on the spindle motor without any issues and my lathe VFD is mounted next to the DRO display with a tacho on top of the VFD, that's worked fine for 20 years or so :D