We perform two-dimensional relativistic magnetohydrodynamic simulations of a mildly
relativistic shock propagating through an inhomogeneous medium. Simulation results show
that the postshock region becomes turbulent owing to preshock density inhomogeneity, and
the magnetic field is strongly amplified due to the stretching and folding of field lines
in the turbulent velocity field. The amplified magnetic field evolves into a filamentary
structure in two-dimensional simulations. The magnetic energy spectrum is flatter than the
Kolmogorov spectrum and indicates that the so-called small-scale dynamo is occurring in
the postshock region.