Hi there! I’m using apache web server on Ubuntu and I need to disable the ability for people to access the website by using the server’s IP address in a web browser. I want it so that when someone attempts to browse to the IP address they get Redirect to the domain.
I tried to google it, I found few tutorials, but they dont work for me.
What configurations would be necessary to do that?
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!
Edit <code>/etc/apache2/sites-enabled/000-default</code> and set DocumentRoot to <code>/dev/null</code>. <br> <br>Add this line: <br> <br><pre>Redirect / http://yourdomain.com</pre> <br>Finally, restart apache: <br> <br><pre>sudo service apache2 restart</pre>
@robert_h_boy: Create a virtualhost for the IP address: <br><a href=“https://p.kk7.me/qeqihuluhe.nginx”>https://p.kk7.me/qeqihuluhe.nginx</a> <br> <br>Replace 1.2.3.4 with your IP address, and yourdomain.com with your actual domain name you want to redirect to.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.