Question

disable http access on DNS server

Hello, My DNS and HTTP servers are same machine and I have ns1, ns2 A records in DNS configuration file. How I can disable following http access?:

  1. http://ns1.mydomain.com
  2. http://ns2.mydomain.com

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! It’s a little unclear what you’re after. If you can expand on your question with some more details, it would help us to better answer it. What are you using as your web server? Apache? Nginx?

Nameservers generally listen on port 53 while HTTP listens on port 80. Assuming you have A records pointing both ns1.mydomain.com and www.mydomain.com to the same IP address, there’s no way to disable HTTP access completely. Though you could make a 403 Forbidden error for requests to ns1.mydomain.com. You could use something like:

<VirtualHost *:80>
    ServerName www.mydomain.com
    DocumentRoot /var/www/html

    # The rest of you VirtualHost configuration....

</VirtualHost>

<VirtualHost *:80>
    ServerName ns1.mydomain.com
    <Location />
        Order allow,deny
        Deny from all
    </Location>
</VirtualHost>

Am on WHM/Cpanel (Centos) with Apache

Can I use any option on WHM to do it ?

I am a beginner, thanks

Where I put this code ?

<VirtualHost *:80> ServerName www.mydomain.com DocumentRoot /var/www/html

# The rest of you VirtualHost configuration....

</VirtualHost>

<VirtualHost *:80> ServerName ns1.mydomain.com <Location /> Order allow,deny Deny from all </Location> </VirtualHost>

Yes, I need exactly this solution ). Thnx