Let's start with the most simple thing, and move forwards as the fundamentals are understood. Germ theory vs terrain theory has been a topic of debate since the late 1800's. Pasteur posited that bacteria (microbes) were the issue. Though we now know that we have bacteria everywhere: your skin, mouth, nose, lungs, gut, etc. If you look embryology, there's three distinct bacterial layers, the mesoderm, endoderm and ectoderm. So if bacteria alone were the problem, we'd all have constant bacterial infections. The opposite of germ theory, that which Pasteur promoted, is terrain theory. Which simply states that is the state of host that determines what bacteria do/behave like. There was a anti-bac craze in 90's with sterile homes and environments that left kids with more allergies than ever before. Doesn't exactly sound like killing of bacteria is the answer. As is evident from the research that goes into how bacteria in the gut function, that certain bacteria have certain implications, like obesity, how much you assimilate, how much kcal you consume, which vitamins are synthesized. For instance: Thiamine, folate, biotin, riboflavin, and panthothenic acid are water-soluble vitamins that are plentiful in the diet, but that are also synthesized by gut bacteria. Likewise, it has been estimated that up to half of the daily Vitamin K requirement is provided by gut bacteria. When you look at it objectively, terrain makes for more sense. If my environment is poor, internal and external, you are much more susceptible for those bacteria to overgrow and start causing issues.
In the virus realm this terrain (environment) theory is called exosome theory. The general “consensus” is that virus's work as the bacteria, except that they are not alive. A virus is a piece of RNA that, given the proper means, will replicate. An exosome is a protein that has bound to toxins that it ejects from the cell to safeguard cell health. So a pattern here is emerging, that is that the environment of both the host and the external environment have a lot to say about what a virus does. A commonly neglected fact or just generally unknown is that we have a virome. From the onset of life, viruses have merged with bacteria, so the entirety of human evolution has had viruses and bacteria. This study on the blood of 8000 individuals and their blood DNA virome  does a good job of summing up why terrain/exosome theory is important.
“Among sequences that mapped to 94 viruses, we identified 19 human viruses in 42% of the study participants. In addition to a wide representation of human herpesviruses and anelloviruses, the study identified 7 different papillomavirus types, including the oncogenic type 16, HIV, HBV, 3 different polyomavirus types and parvovirus B19. These viruses generally correspond to those known to be highly seroprevalent in the human population “
Mind you, this was done in healthy people. There's an additional theory that ties this together, which is that we developed leaky guts so that we could use viruses as rapid adaptation to external (environmental) stimuli through it's RNA information. If a virus was a problem, these people would be dead of the viral load, with a viral load of 94 viruses.
But what about getting infected then? Another good question, which is a question others have been looking at. Take this study: Experiments Upon Volunteers to Determine the Cause and Mode of Spread of Influenza, Boston, November and December, 1918 by M.J Rosenau . Isolating the microbial mixtures from throat and nose of influenza cases from an outbreak location was administered to ten young US Navy volunteers without prior influenza exposure, none got sick. Furthermore, they drew blood from influenza patients and transferred it to the navy volunteers, none got sick. The researchers then collected patients mucous membranes and then injected the navy volunteers, none got sick. Even having influenza patients exhaling on volunteer's faces yielded no one falling ill. That should give us some pause.
Considering that a lot of the gut bacteria can't actually survive out of the gut, that also puts into question how probiotics could work. Because if they can't survive outside of the gut, how can we repopulate the gut them? Adding to to this that everything you eat needs to go through stomach acid, which for our ancestors and ourselves is so high we can eat rotten food and destroy all pathogens. Figuring that a lot of delicacies (especially in the Nordics) are rotten based fish, and blue cheeses are basically rotten cheeses. So when we think about microbiome diversity, the industy in this case is swinging amiss. Where it's a classic case of via negative instead of via positiva. That is: adding things in hardly ever works, especially if our stomach acidity even destroys prebiotic foods like fermented foods. The bacteria in the gut, and thus that microbiome diversity has far more to do with what you are not eating. That is: if I don't feed it carbs, processed carbs, processed foods, alcohol, pesticides, environmental toxins, then the bacteria/fungi/parasite balance stays good. It's common knowledge that alcohol alone increases negative gram bacteria. Processed foods do the same thing, they breed “bad” bacteria, or rather colonies of bacteria that should stay in a different balance. As I wrote above, environmental exposure to bacteria through animals, dirt (soil), air, water and nutrition is what creates microbiome diversity, this in turn determines how strong the immune system is and well it deals with exosomes.
Coming back to terrain vs germ theory before we dive deeper into immunity. Wim hof trained a few volunteers for an experiment where after their breathing and cold exposure training they were injected with bacterial endotoxin that should elicit a pro-inflammatory cytokine response  and yet they managed to dampen it and create anti-inflammatory mediators. This should highlight the effect environment has when being dosed with a concentrated bacterial endotoxin.
Immunity is a multidimensional and multisystem process that also highlights the terrain (+exosome) theory vs germ theory. We know people with a strong immune system don't get sick or don't get sick very often. The mechanics behind it are starting to become more clear. First and foremost, as I've been discussing at length, the liver houses a lot of the immune system. I can't put it any more simply and straightforward than this: healthy and strong liver equals strong immune system. It is the first system that comes into play to detox the body from toxins. The air, water, food is all polluted, if the liver can't clear toxins, the toxin load will build in cells. That's how exosomes are created and ejected from the cell. As an additional detoxification system on a cellular level. Next to that, your lymphatic system is there to pump and flush toxins out of the body. Now when I say toxins, anything coming or build up is subject to this. One of the major mediators for warding infection is LDL, kind of puts a damper on the whole “bad cholestrol” thing . Let's go one step further on building/improving immunity.
In the brisingar group I've mentioned Psychoneuroimmunology. Effectively this means that things that are a major stressor (like fear) down-regulates the immune system. It doesn't stop there though. Because we get that stress would influence, but what about our emotions, which is typically one step above stress, under the umberalla of psychoneuroendocrinoimmunology. Turns out they, of course, also influence the immune system . Now given the fact that your immune system is directly tied to your brain, this shouldn't come as a surprise.
The point is that if we look at things from a holistic perspective, with that I mean in a whole sense of the organism being an extension of the environment and each part of the organism being multidimensional and multidirectional, we can summarize that the best thing you can do for yourself is taking care of yourself.