There are two critical parts to defending a col. They are:
1) Solar power
2) Layout and dome placement
1. Solar Power
It is absolutely critical to have a powerful solar cannon. Fortunately, it is now much easier to have a strong solar with the refinery sliders patch. It is now possible to have a strong solar on almost any planet type, but I love Earths, Oceans, and Mounts. All three of these planet types can have strong solars and make good money.
What you're aiming for is a solar that is atleast a 7 shot 90 burst per minute. Though you should be able to get higher with the settings I will show you. The key rule is that higher bursts per minute is always better than the number of solar shots, if you have to choose one of the two. This is because when you have higher bursts per minute, all your lazors shoot faster as well. The below picture is a 9 shot 107 burst, which is not bad.. that best you can do is 10 shot 120 burst (if this colony below had some researches it easily would be a 10 shot 120 burst). Additionally, when choosing a spread I almost always do narrow. This is because a concentrated spread is often too easy to dodge and medium and wider spreads don't "hurt" enough. Medium spreads are acceptable.

Now, there are three things you have to do in order to get your solar cannon in the desirable range of power. Firstly, you need to get the population of your colony to 9000 - 11,000 (a mount can be 7000 - 9000). In order to do this successfully you need to build every building on your Earth, Ocean, or Mount. For Earths, set your colony at 4% tax and socialism, and harvest organics, medicine and oil, but no anaroebes. For Oceans, set your colony at Democracy and 6% tax, and harvest organics, medicine and oil and anaroebes to about -40 per hour. For mounts, set your colony at Democracy and 6% tax and harvest metal and uranium. Then use the atom smasher to turn metal into organics, oil and medicine, but no anaroebes. These setting will stabilize your colony in the desirable population range. If you get the researches weather prediction or channel descrambling on an ocean, lower anaroebes slightly more. Researches may cause these settings to need to be tinkered with slightly (make sure you don't get to a point where your morale is is falling and pop is growing).
*Note: For servers like The Old Republic which have a population cap set at 10,000, there is no need to use the population stabilizing settings described in the paragraph above. Just harvest organics, medicine, and oil but no anarobes.
The second thing you need to do is set your military to about 40%. (However, if you get the research military tradition this can be lower). If you find that your solar is 120 bursts per minute with 40%, see if you can lower military a little bit and still be at 120 bursts per minute.

The third thing you need to do is set the sliders so you're making as much metal as possible (because the solar canon uses metal, and if you run out of metal your solar will turn off completely). The more metal you can harvest the more shots per burst you'll be able to do (getting to 10 shots per burst ideally). You do this by moving the metal slider so that it is max. Then you move organics, medicine, and oil sliders so that they are just above 0 per hour... just enough so they are not negative. For earths you don't need any anarobe production so turn the slider completely off. For oceans raise the anarobes one to around -40 per hour (this gives partial harvest, meaning your population will shrink sometimes and grow other times... but it will balance out). For mounts move the sliders so that you're only doing metal and urnanium. Set it so that you're doing twice as much metal as uranium (then smash organics, oil and medecine like I mentioned earlier).

*Important notes: Most researches are going to make this process even more powerful. For example, if you get a research that improves your organic harvest, then your organic slider can be lower and your metal slider can be higher. You should always try to get researches.The above colony doesn't have researches so you can see how easy it is to get a strong solar. Secondly, if you want to make weapons in a weapon factory you're generally going to have to weaken your solar slightly because you need to harvest some urnanium and equipment (this takes away from how much metal you cam harvest). However, if you get good researches you should have more than enough room to harvest uranium and equipment (you need to make about 25 per hour of each ideally). The best planet for building weapons is a mount because you're already harvesting lots of uranium and you just need to smash some equipment on top of the other things you are smashing in the atom smasher.
2. Layout and dome placement
To compliment a strong solar you want to have good dome placement on a well layed out planet. Needless to say, you want to have the maximum amount of lazors possible on your colony... this is 125. It is also generally good to have 1 layer of compound mines around your dome.
The number 1 thing you want to avoid is making a colony that is slideable. This is when an invader can easily fly inbetween you lazors and a wall without even killing the lazors. The colony in the picture below, for example, was invaded using 16 nukes or less. These colonies are referred to as "Rings," and are an invaders dream.. so never build them! The red line shows where an invader could just squeeze thru and then he just has to fly to the dome and open it up. You can make a colony harder to slide by making the invader have to turn. The colony in the picture below would be even easier to invade if lazors weren't wrapped around the walls like they are, requiring the invader to make more turns when sliding.

Another good tactic to use is using distractor lazors. This is possible because a nuke will generally veer towards the closest lazor to it when it is shot.So in the picture below, if you were trying to shoot the lazor at the red dot... the lazors pointed to by the red arrow could cause the nuke to veer upwards and get "stuck" on the wall. This means invaders will have to fly further in towards the lazors they want to blow up so their nukes don't get "stuck".

Now the type of layouts you want to have are not easily slidable but generally do have some landing defenses. The absolute best layouts have the dome behind a wall that you need to fly by to get on and off the colony. Some good ones also have the solar very close to the landing but are not easily slideable (these are good because you land with 0 energy, and the solar prevents you from regaining energy upon landing). Below I will post a few dozen solid layouts, with some of my favorite in the first few. Some of the red arrows show an example of how you have to fly right by the solar to get on and off. Now there are many more possible layouts but its safe to say that these are some of the best. *Note: Remember that for these layouts to be effective it is assumed that your solar cannon is at least a 7 shot 90 burst, preferably more (an 8 shot 100 burst is very attainable, all the way up to a 10 shot 120 burst). A lot of these layouts also have places where nukes are going to get "stuck."
1)

2)

3)

4)

5)

6)

7)

8 )

9)

10)

11)

12)

13)

14)

15)

Credits: Burnout and Rush