Linux / Unix | /etc/hosts

Hello community,
I have a little question about file /etc/hosts which the main importance configure with my domain.

For example:
vi /etc/hosts

Virtual Hosts

12.34.56.789 www.my-website.com

This is mandatory when i have a webserver?

1 Reply

Hey there,

The Linux hosts file lives at /etc/hosts and it creates static associations between IP addresses and hostnames, domains, or machine aliases. It is recommended that you have your IP address mapped to your domain in this file to improve system efficacy, but is not strictly necessary depending on your use case. Without this entry, your system would perform a DNS query directly. You can learn a lot about using this file to accomplish your specific goals with our helpful guide.

Virtualhosts are usually only necessary if you're running multiple websites from a single webserver. You can learn more about virtual hosts in Apache's official documentation.

We hope that helps.

Sincerely,
Tara T
Linode Support Team

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