Apache2 sub domain created with virtualmin generating virtual server on ports 80 and 443

Posted October 29, 2020 422 views
ApacheUbuntu 18.04

Should I delete the virtual host on port 80 since I never use it?

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
2 answers

I believe the virtual server on port 80 contains redirection to https://subdomain.yourdomain.something. So, if you remove it (and restart apache2), you will have to put https prefix before your websie address every time you want to access your website (unless your web browser is configured to enforce https connection). Automatic redirection will be no longer performed.

  • That explains why I couldn’t access my domain when I deleted the virtual server on port 80. Thanks 👍 I’ll keep them both since I don’t want to always enter https before the domain name.


As @Yannek explained it creates a redirection from port 80 to port 443. Let me explain a little further so that’s its clear why exactly this happens.

Let’s make an example so it’s easier to explain. Imagine you have a website When you want to load the website in your browser, you often type just the domain - You don’t write - so when you load it, it loads by default with the HTTP protocol. This protocol answers on port 80. Now every application or in the webservice’s configuration has a redirection rule from HTTP to HTTPS (80 to 443).

Removing this rule will make all requests to unreachable thus removing the part where it does the redirection.