The $-NO_2$ group is an electron-withdrawing group $(EWG)$ due to both $-I$ and $-M$ effects. The presence of this group at the $ortho$ position decreases the electron density in the $O-H$ bond,facilitating the release of a proton $(H^+)$.
Furthermore,the $o$-nitrophenoxide ion formed after the loss of the proton is significantly stabilized by resonance involving the nitro group.
On the other hand,the $-OCH_3$ group is an electron-releasing group $(ERG)$ due to its $+M$ effect. This increases the electron density in the $O-H$ bond,making it harder to release the proton.
Therefore,$ortho$-nitrophenol is a stronger acid than $ortho$-methoxyphenol.