Let’s deep dive …
After several unsuccessful attempts to run my own website during last couple of years I finally did it and I would like to share my point of view on this.
Technologically the whole process is not complicated at all however there is a couple of things that can stop people of doing this. Sometimes you have an idea for first, maybe second post but then you struggle with what to publish on your website next, other time you hesitate with the platform you would like to use. Is selfhosting or usage of some VPS better? Maybe posting on same “ready to use” platform will be better option or just stick to the social media and use it as a medium? Those and other questions block people with doing what they are passionate about. I’m not talking only about running website, it’s a general rule. I can tell something about this as I’m more person who thinks twice before do something and many times it took me a chance to achieve something. There is a simple conclusion, if you want to do something just do this for yourself and get satisfaction from it.
In my case I wanted to have place where I would like to gather my thoughts, experience and share this with others in more traditional way without using any kind of currently known social media or other ready to use services where unfortunately you don’t have any control besides content you create but what happen to it latter, where it will be displayed, if people reading it will be tracked or not it’s not up to you. As privacy and control over things I create is important for me I couldn’t use any of “ready to use” solutions. Also being independent more and more became important in my life so why wouldn’t I choose something that will make me more independent but in the same time is cheap solution. One of additional goal here was also to learn something more about servers and I think I achieved this at least on a level I wanted for now.
When you finally decide to run your own website like I did there is a couple of simple things you should consider. Some of them are mandatory and some are just good practice when you put something publicly to the Internet.
- Website should have some name, to be more precise domain.
- You need to have place to host your data.
- You need to consider how you will administrate and secure your server.
- It will be also good to prepare website itself if you still want to.
- You have many options in terms of domains, you can buy well know .com domain or probably one of the cheapest one .xyz. It’s totally up to you. It’s worth to mention then later you can use it also for your mail accounts. There is many domain services you can use, I picked namecheap and it works fine for me.
- You need to configure A record for IPv4 and if you want / your server supports IPv6 then AAAA record as well to point on your server IP address.
- Nowadays it’s a good practice to have https connection on your server so remember about setting up redirect from http to https when you have SSL configured on your server.
- Selfhosting - you can use some machine at your home to host your website. Advantages of this solution is that you have full control, you turn on, turn off this machine whenever you want but on the other side when you don’t have electricity or internet access your website is unavailable for others. You have actually two options how to expose your home machine to the Internet:
- Having static IP from your ISP and then setup port forwarding on your router in order to point to your local server.
- Use some VPS on the Internet as middleware, install there some solution like Inlets that will create tunnel to your local machine where you need Inlets client in this case. More effort but worth checking in terms of learning new technology. I don’t know other similar solutions but Inlets works for me and I use it also for different purposes.
- Use Virtual Private Server - more reliable solution, you don’t need to care about anything besides good configuration of your server. You need to make some decision here:
- Pick a hosting provider - to consider geolocation availability, probably the closest one to you or the closest to the region you want to serve your website. Price (it’s similar between providers) so it shouldn’t be main factor. Available Operating Systems on VPS, Debian, CentOS is classic chooise because you set it up and you can forger about this, from time to time you only need update system if there is anything to update at all. This is very common for so called “stable” distros, if you stick to stable packages they will be probably older and you won’t have a lot of updates. You can also choose something like Arch Linux or Fedora which is not popular pick as they are so called “bleeding edge” distros because they get latest available version of packages which may not be perfect but it doesn’t mean they will be unstable. I’ve been hosting myself something on Arch server since 2019 and I haven’t experienced any issues so far. There is one small downside of using it, more frequently updates require more attention. Parameters of your VPS is something you need to choose as well. For static websites 1 CPU and 1GB of RAM is more then enough even for a couple of websites in the same time. Of course it depends on amount of your visitors but I’m talking here about some common sence. If you want to set up some heavy stack for Wordpress or other platform then you need to check hardware requirements for it by yourself.
Working with the server
- A couple of general points that are recommended to cover in order to safely administrate your server:
- On VPS create none root user and use it instead of root account. Add it to sudo / wheel group.
- Disable root login via SSH.
- Create SSH keys and use them for SSH connections.
- Disable login via SSH using password.
- Change default SSH port from 22 to something else in order to avoid easier attacks to your VPS.
- Invest some time into configuring firewall. If you don’t know how to use iptables you can use something like UFW instead.
- Apply correct rules for SSH ports and also for http (80), https connections (443).
- It’s also worth to setup solution like Fail2ban which works on log files /var/log/… and based on particular rules blocks IPs that for example had too many failures during ssh authorization process. It’s just another layer of security for your server.
- The last thing maybe worth to mention about is blocking partially ICMP protocol that ping uses in order to block any tries of pinging your server. It’s up to you.
Create a website
There is a thousands of tutorials how to create a website and I’m not any expert here so just look for something however my recommendation is to keep it simple. It’s not a contest for the most beautiful website so you don’t need to worry about details at the beginning. Things that were important for me personally was to have fast and not complicated website so I decided to run static html.
by Pawel Zelawski