Many ways to help a door stay put. Longer screws into all the door jams will help, more/better hinges, better locks spread out along the door, etc.
Less obtrusive than the 2x4 is the "door club"
The Door Club (White) - - Amazon.com
Upgrade to a better/steel door (if secured as above) will also help.
As others have mentioned, the screws/bolts have to go into solid material or it matters little.
If I was doing the 2x4 option I would look at running the bolts all the way through the wall (head/nut will need to be secured from removal).
As I moved a lot in the past I would drill a hole in the floor and drop a steel rod into it, simple door club idea. Wouldn't stop them in their tracks, but would slow them some and not hard to fill/fix when I moved again. Put it as close as possible to the door to slow momentum and on the opening edge to reduce leverage.
Hard to explain, but you could also put an eye bolt into each side of the door jam and run a length of chain/cable across the door using a snap link to fix it to the other side. Much harder to lift up/out especially if you use a locking snap link and less common so will confuse/slow a person a bit if they can get to it. Also, not as likely to break as a 2x4.
Not that the 2x4 idea is bad, just other options out there.