Mounting the Flight Controller
Orientation
Almost all Flight Controllers have a heading mark arrow (shown below). The controller should be placed on the frame top-side up, oriented so that the arrow points towards the front of the vehicle (on all aircraft frames - airplane, multirotor, VTOL, ground vehicles etc.).
If the controller cannot be mounted in the recommended/default orientation (e.g. due to physical constraints) you will need to configure the autopilot software with the orientation that you actually used: Flight Controller Orientation.
Vibration Isolation
Flight Control boards with in-built accelerometers or gyros are sensitive to vibrations. Some boards include in-built vibration-isolation, while others come with mounting foam that you can use to isolate the controller from the vehicle.
Vibration damping foam
You should use the mounting strategy recommended in your flight controller documentation.
Log Analysis using Flight Review > Vibration explains how to test whether vibration levels are acceptable, and Vibration Isolation suggests a number of possible solutions if there is a problem.