While trying to edit a host file on a ubuntu server, the docs recommend updating the system's host file saying
The hosts file creates static associations between IP addresses and hostnames or domains which the system prioritizes before DNS for name resolution. Open this file in a text editor and add a line for your Linode’s public IP address. You can associate this address with your Linode’s Fully Qualified Domain Name (FQDN) if you have one, and with the local hostname you set in the steps above. In the example below, 203.0.113.10 is the public IP address, example-hostname is the local hostname, and example-hostname.example.com is the FQDN.
After opening a SSH connection and running
nano /etc/apache2/apache2.conf
The host file can now be edited. After scrolling to the bottom of the page to add the new lines I looked back at the example in the documentation:
127.0.0.1 localhost.localdomain localhost
203.0.113.10 example-hostname.example.com example-hostname
Is this the correct format?
127.0.0.1 localhost.localdomain localhost
104.123.155.24 newhostuser.104.123.155.24 newhostuser
You can add HostName entry in /etc/hosts
file. If you want to run Apache on IP address then you can edit Listen
entry in apache2.conf file.