There are ways to prevent DDoS, First is to get a GOOD HOST, Dont buy from a company that looks suspicious, for example a 4$ per month host and the advertisement says it has DDoS Protection. Its too good to be true, And obviously lying. Second is to block the ports that aren't used.