How to connect a domain to WordPress on a VPS
Running WordPress on your own VPS gives you full control. Here's how to connect your domain, configure the site URL, and secure it with HTTPS.
Running WordPress on your own VPS means full control — any plugin, any theme, real resources, and no platform limits. Once WordPress is installed, the last step is wiring up your domain so visitors reach it by name and over HTTPS. Here's the whole process.
This guide assumes you already have WordPress installed on your VPS (with PHP, a database and a web server like Nginx in place). The focus is connecting the domain.
Step 1: Point the domain at your server
In your domain's DNS settings, add an A record for the root domain and a CNAME for www:
Type: A
Name: @
Value: 203.0.113.10
TTL: 3600
Type: CNAME
Name: www
Value: example.com
TTL: 3600
Replace the value with your VPS's public IP. If you added a dedicated IP on Nxeon, use that. Give DNS time to propagate and verify:
dig example.com +short
When it returns your server's IP, move on.
Step 2: Configure the web server for your domain
Your web server needs to answer for the hostname. In an Nginx server block for WordPress:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/wordpress;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
Reload after editing:
sudo nginx -t && sudo systemctl reload nginx
Step 3: Set the WordPress site URL
This step trips people up. WordPress stores its own URL, and if it still points at an IP or an old address, links and assets break. Set both the WordPress Address and Site Address to your domain.
The clean way is in wp-config.php, which overrides the database:
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');
Use https:// here since you're about to add a certificate. If you set these before HTTPS is ready, use http:// first and switch after Step 4.
Step 4: Add free HTTPS
Issue a Let's Encrypt certificate covering both names. Certbot also sets up the HTTP→HTTPS redirect:
sudo certbot --nginx -d example.com -d www.example.com
Now every visitor is served securely, and the certificate renews itself automatically.
Step 5: Fix mixed content and finish
After switching to HTTPS, some older content may still reference http:// URLs (a "mixed content" warning). Two quick fixes:
- A search-and-replace plugin to update
http://example.comtohttps://example.comacross the database. - Make sure your site URL settings (Step 3) use
https://.
Then load your site, click around, and confirm the padlock shows on every page.
Common gotchas
- Redirect loops — usually a mismatch between the WordPress site URL and how the server or a proxy handles HTTPS. Ensure WordPress knows it's behind HTTPS.
- Login redirects to the wrong domain — set
WP_HOMEandWP_SITEURLcorrectly. - www vs non-www — pick one canonical version and let the other redirect (Certbot and a 301 handle this).
The payoff
With DNS pointed, the site URL set, and HTTPS in place, your WordPress site runs on your own VPS under your own domain — full control, real resources, and a free auto-renewing certificate. On Nxeon, your domain's DNS and your server live in the same dashboard, so you can point the A record and add the certificate without ever leaving the platform.