When playing on a small map, you should be careful and scout your starting location.
When you see a probe coming, try to kill it with two SCVs (micromanagement needed, you will have to round it up).
If it starts building a pylon, send about 5 SCVs to destroy it, since without the pylon all buildings are useless.
You should have at least one or two SCVs gathering minerals at all times and build more while getting rid of the rush.
Then build barracks asap and you should be fine.
So the strategy is like this: if you suspect a canon rush, scout your base once a probe comes in, send 2 SCVs to kill it, micromanage the hunt if the probe starts building a pylon, go for the pylon with more SCVs always have at least 2 SCVs gathering minerals and build more Build Barracks ASAP
gaming.stackexchange.com/users/1297/PeterK
pull your SCVs and kill the pylon.
it doesn't matter if you lose mineral production for a while because your opponent is wasting a ton of their production on buildings that you're destroying. try to keep building more scvs while you're dealing with them though. as long as you can keep your supply depot and barracks coming out roughly on time you should be fine.
gaming.stackexchange.com/users/2995/gazarsgo
If you notice the rush too late, unless they have blocked your ramp preventing your SCVs from leaving, you can also just lift off your buildings and go to your natural expansion and continue as normal.
Preferably with early aggression as they will have wasted so much money on
the cannon rush their base
will have little in it to stop you.
gaming.stackexchange.com/users/1500/en1gmatic325
Didja know terran builings can lift off?
xDI just allow him to build come cannons and then just fly all my buildings to the next expansion.
Build reapers ASAP while he is building cannons to attack you, and destroy his probes and forge and nexus etc.
Then build some marines to support your reapers.
gaming.stackexchange.com/users/None/
You've failed to take into account that the Protoss can just cancel their building and start a new one, so you wasted all that mining time (attacking with SCVs) whereas they only wasted 25 minerals.
Unless you are talking about attacking a building that is already fully built... in which case, is also a bad idea because he will probably be building cannons next to that completed pylon, and will have most likely walled you off (with other incomplete structures) from being able to actually attack it.
Attempting to actually kill a probe (with SCVs) that is doing circles around your base is a complete waste of time, takes about 2 minutes to finally kill it, meanwhile he will just bring another one to your base.
That said, at least 1 worker following the probe will at least force him to keep the probe on the move, somewhat limiting choices for placement.
My best defense so far has been good scouting, walling in most games, and dropping 1-2 bunkers as soon as I see the cannons going up.
You may also try to put workers in likely build places to physically block the Protoss player from walling off their cannons at your mineral line, but this takes some experience.
gaming.stackexchange.com/users/43609/anonymous
Kill the probe first!
A single probe can plop down more pylons/canons faster than your scvs can take them down.
Micro and kill the probe with 2 or 3 scv's.
My strategy against pre-emptively blocking a canon rush is that I build my first supply depot near the edges of my base (not my ramp).
This will allow me to see if anyone is build a pylon or a proxy'ed barrack.
Supply depots are bad choices as wall-ins for ramps anyways, since they have such low hp.
gaming.stackexchange.com/users/3006/LeeMobile
On a small 1v1 map playing Protoss vs. Terran, if the Protoss player brings the probe to build a pylon and forge in a corner of the Terran base, what should the Terran player do?  It seems like the probe is so fast that sending all the SCVs to kill the pylon/probe would slow down mineral gathering.
How does a Terran player stop a cannon rush from Protoss?
gaming.stackexchange.com
<starcraft-protoss><starcraft-terran><starcraft-2>
gaming.stackexchange.com/questions/5799
gaming.stackexchange.com/users/1711/spong
Kill the probe first. If you suspect a canon rush, scout your base once a probe comes in and send 2 SCVs to kill it. The definitive strategy is to kill the probe first, using two SCVs, then keep at least 2 SCVs gathering minerals and build barracks quickly.
Users propose strategies to stop the cannon rush from Protoss