website showing ip address after dns resolve


I’ve done a virtual host config on my lamp server, but it shows the IP address not de DNS name when I access my website.

<VirtualHost *:80>
        ServerAdmin ****@**
        ServerName **
        ServerAlias prm.**
        DocumentRoot /var/www/**

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.cgi index.html index.xhtml


What config I’m missing?

Regards, Renan Paiva


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @renanpaiva,

Did you by any chance, enabled the config, restarted apache and disabled the default one?

Apache includes some tools that allow us to do this.

We’ll be using the a2ensite tool to enable each of our sites. If you would like to read more about this script, you can refer to the a2ensite documentation.

sudo a2ensite

Next, disable the default site defined in 000-default.conf:

sudo a2dissite 000-default.conf

When you are finished, you need to restart Apache to make these changes take effect and use systemctl status to verify the success of the restart.

sudo systemctl restart apache2
sudo systemctl status apache2