How to Link a Domain Name to Your Website or VPS IP on a LAMP Stack

Leave a comment on How to Link a Domain Name to Your Website or VPS IP on a LAMP Stack

When setting up a website on a VPS with a LAMP stack (Linux, Apache, MySQL/MariaDB, PHP) and AlmaLinux OS, you’ll often start by accessing your site through the server’s IP address (e.g., http://1.1.1.1/wordpress). While this works, it’s not practical for real-world use. Instead, you’ll want visitors to access your site using a domain name such as yourdomain.com.

In this guide, we’ll walk through how to link your domain name to your VPS IP by configuring DNS records and setting up an Apache virtual host. Once complete, your website will be accessible directly via your domain name — a critical step before enabling SSL/HTTPS.

Step 1: Register a Domain Name

The first step is to ensure you have a domain name registered through a domain registrar. Providers like RackNerd make it easy to register and manage domains. Once your domain is active, you’ll be ready to configure its DNS settings.

Step 2: Configure DNS to Point to Your VPS IP

Log in to your domain registrar’s control panel and locate the DNS Management section. Create an A Record that points your domain name (e.g., yourdomain.com) to your server’s IP address.

Example:

Type: A

Host: @

Value: 1.1.1.1

TTL: 3600

This step tells the internet where to find your website. DNS propagation may take anywhere from a few minutes to 48 hours to fully update worldwide.

Step 3: Update Your Server

Before configuring Apache, log in to your AlmaLinux VPS via SSH and update the system packages:

dnf update -y

This ensures your server is running the latest updates and security patches.

Step 4: Configure Apache Virtual Host

Next, create a virtual host configuration so Apache knows how to serve your website when someone visits your domain.

Start by creating a new configuration file for your domain:

nano /etc/httpd/conf.d/0001-yourdomain.com.conf

Inside this file, paste the following template and replace the placeholders with your domain name and website directory:

<VirtualHost *:80>

    ServerName yourdomain.com

    ServerAlias www.yourdomain.com

    DocumentRoot /var/www/html/wordpress

    ErrorLog /var/log/httpd/yourdomain.com-error.log

    CustomLog /var/log/httpd/yourdomain.com-access.log combined

</VirtualHost>

Save and exit the file (CTRL+X, then press Y and Enter).

Step 5: Restart Apache

For the changes to take effect, restart Apache:

systemctl restart httpd

Your server is now configured to serve your website from the domain name you specified.

Step 6: Check DNS Propagation

Since DNS propagation can take time, verify that your domain is resolving correctly to your VPS IP. You can use tools like dnschecker.org to confirm whether the A record has updated globally.

If it hasn’t propagated everywhere yet, don’t worry — this is normal. Sometimes using a VPN to connect through a region where propagation is complete allows you to test sooner.

Step 7: Test Your Domain

Finally, open your browser and navigate to your domain (e.g., http://yourdomain.com). If everything is set up correctly, your website will load from the LAMP stack on your VPS.

Conclusion

Linking your domain name to your VPS IP is a critical step in making your website publicly accessible. By setting up DNS records and configuring Apache virtual hosts, you create a professional and reliable way for visitors to reach your site.

The next step after this would be enabling SSL to secure your website with HTTPS — something we’ll cover in a future guide.

At RackNerd, we make hosting easier by providing affordable VPS and dedicated servers, backed by 24/7 support. Whether you’re running a personal site or managing multiple projects, our infrastructure ensures your websites run smoothly and securely.

Explore our hosting solutions today at racknerd.com.

Server Hosting Solutions by RackNerd:

Shared Hosting
cPanel Web Hosting in US, Europe, and Asia datacenters
Logo
Reseller Hosting
Create your new income stream today with a reseller account
Logo
VPS (Virtual Private Server)
Fast and Affordable VPS services - Instantly Deployed
Logo
Dedicated Servers
Bare-metal servers, ideal for the performance-demanding use case.
Logo

Leave a comment

Your email address will not be published. Required fields are marked *