Question

website showing ip address after dns resolve

Posted April 27, 2021 254 views
ApacheLAMP StackDNS

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

edited by KFSys

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.

×
Submit an Answer
1 answer

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