Relativistic astrophysical collisionless shocks represent outstanding dissipation agents of the huge power of relativistic outflows produced by accreting black holes, core collapsed supernovae and other objects into multi-messenger radiation (cosmic rays, neutrinos, electromagnetic radiation). This article provides a theoretical discussion of the fundamental physical ingredients of these extreme phenomena. In the context of weakly magnetized shocks, in particular, it is shown how the filamentation type instabilities, which develop in the precursor of pair dominated or electron-ion shocks, provide the seeds for the scattering of high energy particles as well as the agent which preheats and slows down the incoming precursor plasma. This analytical discussion is completed with a mesoscopic, non-linear model of particle acceleration in relativistic shocks based on Monte Carlo techniques. This Monte Carlo model uses a semi-phenomenological description of particle scattering which allows it to calculate the back-reaction of accelerated particles on the shock structure on length and momentum scales which are currently beyond the range of microscopic particle-in-cell (PIC) simulations.