Get a domain name, DNS and SSL certificate for free

    Hello, Habr. This post is intended for lovers of freebies and contains a ready-made recipe for obtaining a domain name, DNS server services and SSL certificate with a cost of 0 rubles 0 kopecks. Free cheese happens only in a mousetrap and this is true, so the recipe is more likely for those who want a beautiful link to their personal small project with https support and not for serious projects.


    Domain name


    We go to the site www.registry.cu.cc , immediately drive the desired name there and click check availability => checkout if the desired name is available. Then we register and go to your personal account where we see our domain names.

    img1


    img2


    We find the desired name, go to Nameserver and register Yandex DNS there.

    img3


    img4


    DNS server


    Next, go here pdd.yandex.ru/domains_add and add the just created domain name.

    img5


    We see that “Failed to find the domain in DNS”, wait until Yandex finds it.

    img6


    After that, we confirm ownership of the domain by adding the corresponding CNAME record as written in the detailed Yandex instructions. Then we wait until Yandex finds the record it needs and confirms the ownership of the domain. It may take quite some time.

    img7


    img8


    img9


    After that, we see the long-awaited inscription that the domain is connected and delegated to Yandex DNS.

    img10


    Next, go to the DNS Editor and add an A - record linking the domain name to the ip - address of your server.

    img11


    It may take quite a while before this A - record takes effect. Let's start something locally (after all, we registered the server address 127.0.0.1) and see how our domain resolves. Works!

    Hooray!


    That's all with the DNS server, now let's get an ssl certificate and provide access to our server via https (security above all).

    SSL certificate


    We go to www.startssl.com/Validate , register, select Validations Wizard => Domain Validation (for SSL certificate) , enter our domain

    img12


    And there we are offered to prove that we own the domain using e-mail, select any one that we like, create it in Yandex. We send a letter there, take the code from there and prove that the domain belongs to us.

    img13


    img14


    img15


    Then we go to Certificates Wizard => Web Server SSL / TLS Certificate , specify our domain, generate and paste the key and click submit

    img16


    The key can be generated for example like this
    mkdir ./certificates
    mkdir ./certificates/habr.cu.cc
    cd ./certificates/habr.cu.cc
    openssl genrsa -out ./habr.cu.cc.key 2048
    openssl req -new -sha256 -key ./habr.cu.cc.key -out ./habr.cu.cc.csr
    cat ./habr.cu.cc.csr
    

    Certificate received! Download the archive

    img17

    Unpack and copy the key files to the nginx directory

    cp ~/Downloads/habr.cu.cc/1_habr.cu.cc_bundle.crt /usr/local/etc/nginx/1_habr.cu.cc_bundle.crt
    cp ./habr.cu.cc.key /usr/local/etc/nginx/habr.cu.cc.key
    nano /usr/local/etc/nginx/nginx.conf
    

    A little we straighten a config Restart nginx

    server {
    listen 8080;
    ssl on;
    server_name localhost;
    ssl_certificate /usr/local/etc/nginx/1_habr.cu.cc_bundle.crt;
    ssl_certificate_key /usr/local/etc/nginx/habr.cu.cc.key;



    nginx -s stop
    nginx
    

    We open our page using https ... and everything works!

    Hooray!


    We got a domain name, DNS server services and a confirmed SSL certificate without paying a dime to anyone, and it’s completely legal. To launch our ultra-mega-gig service, it remains only to raise the VPS and deploy our program there. Alas, today a free VPS is too good and unrealistic; you still have to pay with bloody dollars from your pocket for a VPS server. Nevertheless, all have a good weekend and I hope the note will be useful to someone.

    Also popular now: