Dns Records For non-www domain

Hi,
My primary domain is www.example.com.

1- In /etc/apache2/sites-available/example.com.conf file should i write www domain for server name and non-www domain for server allias? Or should i write the opposite?

2- In DNS records www domain has records but i didnt create any records for non-www domain. Should i create dns records for non-www domain not to have problem during the installation of ssl certificate or in other fields?

1 Reply

I'm assuming you're going to use Linode's DNS Manager for this.

Let the IP address of your Linode be 192.168.0.1.

  • Set an A/AAAA record for example.com to be 192.168.0.1 with a default TTL.
  • Set an A/AAAA record for www to be 192.168.0.1 with a default TTL.

Commit your changes and wait 24-48 hours depending on your location in the world…then test it:

  • ping example.com should reply with 192.168.0.1.
  • ping www.example.com should reply with 192.168.0.1.

Repeat for IPv6 addresses (except use ping -6 to test).

In /etc/apache2/sites-available/example.com.conf file should i write www domain for server name and non-www domain for server allias? Or should i write the opposite?

This depends on your preference. I would use:

ServerName example.com
ServerAlias www.example.com

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct