Can I Host My Own Website on My Own Computer?

Just learn HTML,CSS,JS then write a website. Save it on your computer. Use a apache server as webserver for your website. If you can reach your website over localhost:80 you are almost good to go.

Now comes the hosting part. First of all doing that will end up in very very bad. I assure you. But for learning purposes I will still explain it and then why you shouldn't ever do it.

First of all you need full control over your internet connection. So if you are in a form and just use the dorms internet it wont work.

Assuming you have full control you can open inbound ports in your router. If you serve your files on port 80 you have to enable inbound port 80. Which basically means turning of your routers firewall for that port. There might be a firewall on your computer too. Needles to say you need to turn it off. Your computer will now be accessible by the internet. As I said if you are in a hotel or something like that you won't be able to access their routers config without credentials. You need to keep in mind that your computer needs to stay on and that you don't have a domain yet. You will only be able access your site via IP. Just google “what is my ip” and you will know your ip. BUT depending on your provider it might also change. Sometimes on a daily bases.

Now comes the good part. I actually did it ones and I was glad that I couldn’t access my dorms router. Some years later I worked on an university web project and hosted the website on the internet. It was a linux system and you have a command to see who tries to log n on your computer. There where like thausands of failed requestsevery single day. Because the internet is full of bots that are scanning every single ip adress in the internet and also every typical port, like - you guessed it - port 80, but also 3306 (MySQL), 21 (FTP), 22(SSH) and so on…

They are also using different approaches to access your computer. For Instance, you use xampp for website hosting which is only for development but still a lot of people try it either way (like me). The Hacker knows about newbies and uses xampps security issues to access your computer. He might then install ransomware or worse use your computer as file sharer for illegal stuff like child pornography. You would never ever notice it unless you check your traffic, cpu and disc usage on a regular basis. But noone does that. In the eye of the law you are the culprit because your computer is the distributor.

I know all that sounds really scary and it actually is, but once you have an own server on the internet and check the failed log in attempts, you will think differently about security. Nonetheless, you still can get more if you use an expert web hosting solution.