So you have seen my posts about creating your VPN, SSH key, rsync and all, but you dont even have a website? Makes sense, because I should have posted this post earlier.
So lets go under and hour, we will have our basic webpage up and running on our VPS server.
- Get your domain name
I suggest njal.la as they do not share your whois. Simple interface, everything is nice. Choose whatever you want and buy it.
- Get a server
There are tons of server options. Server means, there is a computer which has your files constantly broadcasting to internet. You can use this server as a website host, email server, file-sharing service, mirc server.. and much more
So lets go get a VPS (Virtual Personal Server)
I am using 1984.hosting again extremely simple interface, located in iceland, fast support, relatively cheap. A basic VPS will cost you around 5euro per month.
You can use others like digitalocean, Vultr, Privex and much more.
So lets create a VPS, select debian a server operating system with no addons. About server size, first choose the cheapest option, they will let you expend if you need more.
Also enable IPv6 for future.
- Connect your Domain and Server
Open your domain registrar and DNS records.
Put your server’s IPv4 address to A and IPv6 address to AAAA value. Save and after couple of minutes (sometimes and hour) test with terminal
ping yourdomain.net if you see the same IP with your server, then everything is ok.
- Set up NginX webserver
Login to your server
ssh root@yourdomain.net
If you cannot, it means your DNS settings are not correct, or it is not updated yet, check step 3.
First update packages, then install nginx.
|
|
Create a file in /etc/nginx/sites-available by
nano /etc/nginx/sites-available/mywebsite
then add following content into it.
|
|
Create the directory for your website:
mkdir /var/www/mysite
nano /var/www/mysite/index.html
|
|
Enabling the website:
ln -s /etc/nginx/sites-available/mywebsite /etc/nginx/sites-enabled
and reload nginx service
systemctl reload nginx
The Firewall:
Just to be on the safe side install firewall and allow website and mail ports as well as yourself.
|
|
- Certbot and HTTPS
To enable encrypted connections over HTTPS/SSL we need to do these:
apt install python3-certbot-nginx
certbot --nginx
Do not use or give your mail address, no need. It is all done, now lets create certificate renewal:
crontab -e
add 0 0 1 * * certbot --nginx renew
to end of the line and save this.
VOILA!
Now you have a server, and a basic intro webpage up and running.
🌊⛰🔥