Three Different Ways,

1) Install Physical Firewall of awesome company like Cisco OR
2) Use CDN like Cloudflare (www.cloudflare.com) OR
3) Buy Hosting from DDoS Protected Hosting Company like www.ShinJiru.com

You can minimize or even stop a DDoS attack if the attack is smaller. If someone with access of a data center (though its a very rare case) well then it is very difficult to stop them :/