Question

website showing ip address after dns resolve

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


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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