The rules of the game are set down by soccers world governing body, FIFA. The associations official handbook is a 140-page document, which includes detailed discussion of every foul, infraction, and regulation in the game. You can locate it here.
Short of that, here is a summary of the different infractions that will lead the referee to blow the whistle, end play, and possibly take disciplinary action, as worded by FIFA.

Direct Free Kick
Definition: When the referee stops play for positive fouls, he may award a team a direct free kick, meaning that team will resume play from the spot of the infraction with a pass or a shot at goal. Any members of the opposing team must be at least 10 yards away when the ball is struck. If the free kick were indirect, it means that a second player must touch the ball before it the team can shoot at goal.

A direct free kick is awarded to the opposing team if a player commits any of the following six offenses in a manner considered by the referee to be careless, reckless or using excessive force:

kicks or attempts to kick an opponent
trips or attempts to vacation an opponent
jumps at an opponent
charges an opponent
strikes or attempts to strike an opponent
pushes an opponent
A direct free kick is also awarded to the opposing team if a player commits any of the following four offences:

tackles an opponent to get possession of the ball, making contact with the opponent before touching the ball
holds an opponent
spits at an opponent
handles the ball deliberately (except for the goalkeeper within his own penalty place)

Penalty Kick
A penalty kick is awarded if any of the above ten offences is committed by a player inside his own penalty place, irrespective of the position of the ball, provided it is in play.

One player may then take a free shot at goal (defended only by the goalkeeper standing upon the goal line) from the penalty spot, located 12 yards away.

Indirect Free Kick
An indirect free kick is awarded to the opposing team if a goalkeeper, inside his own penalty place, commits any of the following offences:

takes more than four steps while controlling the ball with his hands, before releasing it from his possession
touches the ball again with his hands after it has been released from his possession and has not touched any other player
touches the ball with his hands after it has been deliberately kicked to him by a team-mate
touches the ball with his hands after he has received it directly from a throw-in taken by a team-mate
An indirect free kick is also awarded to the opposing team if a player, in the opinion of the referee, commits any of the following three offences:

plays in a dangerous manner
impedes the progress of an opponent
prevents the goalkeeper from releasing the ball from his hands
commits any other offence, not previously mentioned, for which play is stopped to caution or dismiss a player

Yellow and Red Cards
After awarding a free kick or penalty kick, a referee may take further disciplinary action against a player by showing him a yellow or red card.

Yellow Cards
A player is cautioned and shown the yellow card if he commits any of the following seven offences:

is guilty of unsporting behaviour
shows dissent by word or action
persistently infringes the Laws of the Game
delays the restart of play
fails to respect the required distance when play is restarted with a corner kick or free kick
enters or re-enters the field of play without the referee’s permission
deliberately leaves the field of play without the referee’s permission

Red Cards
A player is sent off and shown the red card if he commits any of the following seven offences:

is guilty of serious foul play
is guilty of violent conduct
spits at an opponent or any other person
denies an opponent a goal or an obvious goal-scoring opportunity by deliberately handling the ball (this does not apply to a goalkeeper within his own penalty place)
denies an obvious goal-scoring opportunity to an opponent moving towards the player’s goal by an offence punishable by a free kick or a penalty kick
uses offensive, insulting or abusive language
receives a second caution in the same match