Report this

What is the reason for this report?

website showing ip address after dns resolve

Posted on April 27, 2021

Hi,

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 ****@**thy.com
        ServerName **thy.com
        ServerAlias prm.**thy.com
        DocumentRoot /var/www/**thy.com/public_html

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

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

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

</VirtualHost>

What config I’m missing?

Regards, Renan Paiva



This textbox defaults to using Markdown to format your 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 example.com.conf

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.