Pointing a domain at a VPS requires two separate configurations: DNS must send the hostname to the VPS address, and the web server must choose the correct site and directory. Create an A record for the VPS IPv4 address (and an AAAA record for IPv6 when configured), then define the hostname in NGINX or Apache and map it to the directory containing your site files.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
DNS alone cannot select a web directory. If the hostname reaches the VPS but you see the NGINX welcome page, an Apache test page, or another site, the DNS is probably working and the server’s virtual-host configuration is not yet matching the request.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
How the domain-to-site mapping works
A browser sends a request containing a hostname such as example.com. Four pieces must line up before the intended page is returned:
- DNS record: the hostname resolves to the VPS public IP address.
- Site selector: NGINX uses
server_name; Apache usesServerNameand, when needed,ServerAlias. - Web root: NGINX’s
rootor Apache’sDocumentRootidentifies the directory where files are read. - Listener and permissions: the server accepts the request on the required port and its worker process can read the files.
These layers are independent. Creating an Apache virtual host does not create DNS entries, and adding a DNS record does not configure NGINX or Apache.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Before you change anything
- Have the VPS public IPv4 address. If IPv6 is enabled and routed to the VPS, record its public IPv6 address as well.
- Know which DNS provider is authoritative for the domain. Make changes there, not necessarily at the company where the domain was purchased.
- Know whether the VPS uses NGINX or Apache and which distribution layout it follows.
- Prepare the absolute filesystem path that will hold the site, such as
/var/www/example. The directory must contain the index file and all required assets. - Ensure the VPS firewall and hosting controls allow TCP port 80 for HTTP. Port 443 will also be needed for HTTPS.
- Have administrative access for editing server configuration, enabling a site, testing configuration, and reloading the service.
1. Create the DNS records
Open the DNS management screen at the authoritative DNS provider and create records for the names you intend to serve.
| Hostname | Record | Value | When to use it |
|---|---|---|---|
@ (the apex, represented by example.com) |
A | VPS public IPv4 address | For the bare domain |
@ |
AAAA | VPS public IPv6 address | Only when IPv6 is configured and reachable on the VPS |
www |
A or CNAME | The VPS IPv4 address for an A record, or the intended canonical hostname for a CNAME | When visitors should be able to use www.example.com |
An A record points a name to IPv4; an AAAA record points it to IPv6. If you publish an AAAA record, the VPS must actually accept web traffic on that IPv6 address. An unreachable IPv6 path can make some visitors fail even though IPv4 works.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Decide whether the apex and www names are both supported. If both are listed in the web-server configuration, they can serve the same site. You can instead redirect one to the other, but the redirect must be configured by NGINX or Apache; DNS does not perform an HTTP redirect.
Check the result from a shell with:
dig +short example.com
The output should include the VPS IPv4 address. When IPv6 is enabled, check it separately:
dig +short AAAA example.com
Test the www name independently if you created a record for it. Resolver caches can cause different networks to observe old data for a period after a change, so verify from the DNS provider and with more than one resolver before treating a server configuration as faulty.
2. Create the site directory and web root
Create the directory that will hold this site’s files, then place an index file in it. For a simple static site, the directory might be /var/www/example and the entry point might be index.html. An application may use a different front controller or require a runtime-specific public directory.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
sudo mkdir -p /var/www/example
sudo nano /var/www/example/index.html
The exact ownership model depends on your deployment process. The web-server process needs read access to directories and files, while deployment users need write access only where required. Avoid making the entire site world-writable. If the server returns “permission denied,” inspect each parent directory’s execute permission as well as the file’s read permission.
3. Configure NGINX
Write a server block
In distributions that use the sites-available/sites-enabled layout, create a file such as /etc/nginx/sites-available/example. A minimal HTTP configuration is:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
The server_name values must match the hostnames users request. The root directive is the filesystem path in which NGINX searches for static files. It is not a URL and must point to the directory that actually contains the site.
Enable the site and avoid the default server
On layouts that use a separate enabled directory, link the definition into it:
Free tools Windows power users keep installed
One-click scans. No signup required.
sudo ln -s /etc/nginx/sites-available/example /etc/nginx/sites-enabled/example
If the distribution installed a default site that catches requests before the intended definition, disable or remove that default link according to the distribution’s conventions. Do not delete a file you still need; removing the enabled link is usually safer.
Validate before reloading
Always test the complete NGINX configuration before applying it:
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
sudo nginx -t
Only when the test reports a valid configuration should you reload:
sudo systemctl reload nginx
A reload applies the new configuration without unnecessarily terminating existing connections. If the test fails, read the file and line number in the error, correct it, and run nginx -t again. Do not reload a configuration that has not passed validation.
4. Configure Apache
Define a virtual host
On an Apache installation using the common Debian-family layout, create a file such as /etc/apache2/sites-available/example.conf:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example
<Directory /var/www/example>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/example-error.log
CustomLog ${APACHE_LOG_DIR}/example-access.log combined
</VirtualHost>
ServerName identifies the primary hostname. Add ServerAlias for additional names such as www.example.com. DocumentRoot is the directory Apache serves for this virtual host. The Directory permissions shown above are suitable for a site that needs Apache to read files; AllowOverride All is only appropriate when the application intentionally uses .htaccess.
Enable and test the virtual host
On systems with the Debian-family helper commands, enable the site and reload Apache:
sudo a2ensite example.conf
sudo apachectl configtest
sudo systemctl reload apache2
On other distributions, enable the virtual host using that distribution’s layout and service tooling. The important sequence is the same: make the definition active, run the server’s configuration test, and reload only after the test succeeds.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteRank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
If Apache’s default virtual host is answering first, disable it or adjust the enabled-site order so the request with your hostname reaches the intended definition. Keep the default definition available until the replacement has been tested if you need an easy rollback.
5. Confirm that the hostname selects the right files
Test each hostname separately. A DNS lookup confirms the address, but an HTTP request confirms that the web server selected the intended site:
curl -I http://example.com
curl -I http://www.example.com
For a content check, request the page body and look for a distinctive marker in your test index file:
curl http://example.com
If the response is the NGINX default page, Apache’s test page, or another customer’s site, the request reached the VPS but matched a different server definition. Check the spelling of server_name, ServerName, and ServerAlias, confirm the intended file is enabled, and disable the default site if it is catching the request.
If the response is a 404, the selected root may be wrong, the requested file may not exist, or an NGINX location or Apache rewrite rule may be routing the request elsewhere. If it is a 403, inspect directory and file permissions and any access-control rules. Server error logs usually identify the exact path or rule involved.
6. Add HTTPS after HTTP works
Get the HTTP site working first. Certificate validation depends on both DNS and the web server: the certificate authority must be able to resolve the domain to your VPS and fetch a challenge file through the domain’s HTTP endpoint.
Best Value
Use the server integration
Certbot provides NGINX and Apache integrations that can request a certificate and update the relevant HTTPS configuration. A typical invocation names every hostname that should appear on the certificate:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutesudo certbot --nginx -d example.com -d www.example.com
For Apache, use the Apache integration instead:
sudo certbot --apache -d example.com -d www.example.com
The exact command available depends on how Certbot was installed. Review the proposed changes, and make sure both names resolve to this VPS before starting validation.
Use the webroot method
With webroot validation, Certbot writes a temporary challenge file into the top-level directory served by the web server. For the example root, that is /var/www/example:
sudo certbot certonly --webroot -w /var/www/example -d example.com -d www.example.com
Validation succeeds only if a request to each domain’s HTTP challenge path reaches that directory without being blocked by a redirect, authentication rule, proxy, or incorrect virtual host. If validation fails, test the challenge path over HTTP and inspect the web-server access and error logs before trying again.
Protect the private key
HTTPS requires an SSL listener plus paths to the certificate and private key. The private key must have restricted filesystem access so ordinary users and unrelated services cannot read it. Do not paste private-key contents into public tickets, repositories, or web directories.
After certificate installation, test both HTTPS names and confirm the intended HTTP-to-HTTPS behavior. Keep the operating system’s scheduled renewal mechanism enabled and perform a renewal test using the method supplied by your Certbot installation. A certificate that works today still needs an automated renewal path.
NGINX and Apache: which configuration model fits?
| Concern | NGINX | Apache |
|---|---|---|
| Site definition | server block |
<VirtualHost> block |
| Hostname matching | server_name |
ServerName and ServerAlias |
| Filesystem root | root |
DocumentRoot |
| Request routing | location blocks can serve files or proxy requests |
Virtual hosts can serve files or use modules such as mod_proxy |
| Operational choice | Use the server already supported by your application stack and distribution tooling; the DNS procedure is the same. | |
Neither server is inherently required by DNS. If your application’s deployment instructions, modules, or control panel expect one server, using that server generally avoids conflicting service definitions and duplicated proxy rules.
Troubleshooting by symptom
The domain does not resolve
- Run
dig +short example.comand compare the answer with the VPS IPv4 address. - Check the AAAA record separately if IPv6 is published. Remove or correct an AAAA record that points to an address where the site is not listening.
- Confirm that you edited the authoritative DNS zone and that the hostname is spelled correctly.
- Check the
wwwrecord independently; an apex record does not automatically create a workingwwwhostname.
The VPS responds, but the default page appears
- Confirm the requested hostname appears exactly in NGINX
server_nameor ApacheServerName/ServerAlias. - Confirm the site definition is enabled in the active configuration directory.
- Disable the default site that is receiving unmatched requests.
- Run the configuration test, reload the server, then retry with
curl.
You receive 403 Forbidden
- Verify that the configured root exists and contains the expected index file.
- Check read permission on the file and execute permission on every parent directory for the web-server user.
- Review Apache directory access rules or NGINX location rules.
- Read the error log; it normally names the denied path or policy.
You receive 404 Not Found
- Check that
rootorDocumentRootpoints to the directory containing the requested file. - Check whether an application front controller, rewrite rule, or proxy location expects a different path.
- Confirm that the request is reaching the intended virtual host rather than a similarly named site.
HTTPS validation fails
- Make sure port 80 is reachable from the internet; ACME HTTP validation starts there.
- Confirm every certificate hostname resolves to this VPS.
- Place the challenge file under the same served root used by the webroot command.
- Temporarily remove authentication or blocking rules for the challenge path, then restore the intended protection after issuance.
- Check logs for redirects, proxying, permission errors, or a default virtual host serving the challenge request.
HTTPS works for one name but not the other
Check the second name’s DNS record, virtual-host alias, certificate name list, and HTTPS listener. A certificate and configuration for example.com do not automatically cover www.example.com unless that name was included.
Quick Recap
Maintenance checklist
- Keep the A and AAAA records aligned with the VPS addresses currently in use.
- Retest both apex and
wwwhostnames after changing DNS, server definitions, or deployment paths. - Run
nginx -tor the Apache configuration test before every reload. - Watch access and error logs after deployments and configuration changes.
- Keep port 80 available when using HTTP-based certificate validation and keep port 443 available for HTTPS visitors.
- Limit permissions on certificate private keys and any application secrets.
- Verify that scheduled certificate renewal is enabled and that renewed certificates are loaded by the service.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.




