It's all about the type of pathogen. For example. Salmonella is found more in dry environments while listeria is found more in wet environments.
As for food, the US uses the acronym FAT TOM to explain what conditions most bacteria grow best in.
F
Food
There are sufficient nutrients available that promote the growth of microorganisms. Protein-rich foods, such as meat, milk, eggs and fish are most susceptible.
A
Acidity
Foodborne pathogens require a slightly acidic pH level of 4.6-7.5, while they thrive in conditions with a pH of 6.6-7.5.
T
Time
Food should be removed from "the danger zone" (see below) within two-four hours, either by cooling or heating. While most guidelines state two hours, a few indicate four hours is still safe.
T
Temperature
Food-borne pathogens grow best in temperatures between 41 to 135 °F (5 to 57 °C), a range referred to as the temperature danger zone (TDZ). They thrive in temperatures that are between 70 to 104 °F (21 to 40 °C).
[3]
O
Oxygen
Almost all foodborne pathogens are aerobic, that is requiring oxygen to grow. Some pathogens, such as
Clostridium botulinum, the source of botulism, are anaerobic.
M
Moisture
Water is essential for the growth of foodborne pathogens,
water activity (a
w) is a measure of the water available for use and is measured on a scale of 0 to 1.0. Foodborne pathogens grow best in foods that have a
w between 0.95 and 1.0. FDA regulations for canned foods require a
w of 0.85 or below.