1

I have a vps in IONOS with ubuntu 18.04.

I have followed this tuto to configure apache , and my new website.

Right now , the website work only with ip address but not with domain name.

This is www.mydomainname.com.conf under /etc/apache2/sites-available

<VirtualHost *:80>
ServerAdmin admin@mydomainname.com
ServerName  www.mydomainname.com
DocumentRoot /var/www/html/www.mydomainname.com
<Directory /var/www/html/www.mydomainname.com/>
    AllowOverride All
    Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

and this is my the config under /etc/hosts

127.0.0.1       localhost.localdomain localhost
127.0.1.1       localhost
82.165.112.22   www.mydomainname.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

That's all

hous
  • 225

2 Answers2

2

That process links your internal IP to a domain name, so that localhost resolves to www.domain.com locally, but you will need to purchase a domain name from a hosting provider, in order to link a public IP with your domain name for access on the internet.

0

I had the same problem, but in my /etc/hosts/ I forgot to add my IP and next to it my domain.

Well, for local purposes it works, but if you want it to be available on the internet, you need to purchase the domain name.

Chris
  • 1