Securing My Domain with HTTPS: From IP to arsank47.dev

17-07-2024

Introduction

In this post, I will outline my experience setting up a domain name (arsank47.dev) to link to my IP address. The project involved using Dynadot for domain registration, creating DNS records, installing an Nginx reverse proxy, and securing the domain with HTTPS using Certbot. After some initial challenges with stability on an Alpine VM, I transitioned to using an Ubuntu Server VM on Proxmox for a smoother experience.


Domain Registration and DNS Configuration

The first step in establishing a web presence is acquiring a domain name. I chose Dynadot, a reputable domain registrar known for its competitive pricing and user-friendly interface.

Once the domain was registered, the next crucial step was configuring the DNS settings. DNS (Domain Name System) translates human-readable domain names into machine-readable IP addresses, allowing users to access websites by typing a domain name instead of a numeric IP address.

To link my domain to my server, I created A Records, which directly associate my domain name (arsank47.dev) with my public IP address. I also set up CNAME Records for subdomains, if applicable, to ensure they redirect to the primary domain seamlessly.


Nginx as a Reverse Proxy

With the domain linked to my IP address, I turned to Nginx to handle incoming requests. Nginx is a high-performance web server that excels in serving static content and acting as a reverse proxy. A reverse proxy sits between clients and servers, forwarding client requests to the appropriate backend services. This allows for better load balancing, security, and ease of management.

By configuring Nginx as a reverse proxy, I could route requests to different applications running on my server without exposing their ports to the internet. This setup enhances security and allows for cleaner URL structures.

Additionally, my ISP, Virgin Media, imposes limitations on the number of port forwards—restricting them to around 20 or 30. Using Nginx as a reverse proxy significantly mitigated this issue, allowing me to host multiple services on my server while only requiring a single port forward. This streamlined my network configuration and simplified access to my applications.


Securing the Domain with HTTPS Using Certbot

To protect user data and improve search engine rankings, securing the domain with HTTPS is essential. HTTPS encrypts data transmitted between the client and server, safeguarding it from eavesdroppers. I used Certbot, a widely adopted tool, to obtain and manage SSL certificates from Let’s Encrypt.

Certbot automates the process of obtaining SSL certificates and configuring Nginx to use them. This not only simplifies the setup but also ensures that certificates are renewed automatically, maintaining secure connections without manual intervention.


Transition from Alpine to Ubuntu Server VM

Initially, I set up the project on an Alpine VM. While Alpine is known for its lightweight design and security features, I faced several challenges regarding package stability and compatibility. After careful consideration, I transitioned to an Ubuntu Server VM on my Proxmox server.

The switch to Ubuntu provided several advantages:

  • Wider Community Support: Ubuntu has a large user base, making it easier to find solutions to issues and receive community support.
  • Stable Package Management: Ubuntu’s APT package management system offers a smoother experience for installing and updating software, ensuring reliable access to necessary packages.
  • Comprehensive Documentation: The extensive documentation available for Ubuntu significantly aided in the setup and troubleshooting process.

Conclusion

This setup successfully established a reliable and secure connection for my domain, arsank47.dev. By leveraging Dynadot for domain registration, Nginx as a reverse proxy, and Certbot for HTTPS, I created a robust infrastructure to serve my applications. The transition to an Ubuntu Server VM provided the stability and performance needed for ongoing development and deployment.


Sources: