Redirect http to https on Webmin

To redirect the non-SSL site to SSL site becomes quite easy with the advanced feature in Webmin control panel.

Let’s take a closer look at how we configure redirection to HTTPS in Webmin.

1. First, we logged into Webmin panel.

2. Next, go to Webmin > Webmin Configuration > SSL Encryption .

3. Then, selected Redirect non-SSL requests to SSL mode? to Yes.

4. After that, we go to Virtualmin > System Settings > Virtualmin Configuration.

5. And in the SSL settings column, we selected Yes on the Redirect HTTP to HTTPS by default?.

6. Finally, saved the file.

Now, the users could automatically access the URL without typing http or https in front of the URL.

The top 2 common problems after setting redirection to HTTPS in Webmin

Even after setting HTTPS redirection properly, we often see errors.

1. Incorrect .htaccess rule in Apache

Recently, one of our customers reported that after setting the redirection and when he tried to access the Webmin URL, it doesn’t seem to work properly. Also, he mentioned that he was using the Apache web server.

So, to fix the problem we took the following steps.

1. First, we logged into Webmin.

2. And we navigated to Virtualmin section.

3. Then we located Configure Websites under Services.

4. Next, we clicked Edit Directives and looked for RewriteEngine On.

5. Then under RewriteEngine On we pasted the rule like

RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [R]

6. Finally, we restarted apache to save the changes made.

/etc/init.d/apache2 restart

Now, the user could automatically access the URL without any failure.

2. Bad settings in Nginx configuration file

Likewise, another customer approached us with the problem after redirection in Webmin has set and when he tried to access the URL it resulted in an error like this

This error normally arises when you do not properly configure Nginx settings to handle both HTTP and HTTPS requests.

So, to solve this error we performed the following steps.

1. First, we opened the Nginx configuration file in vim editor.

vim /etc/nginx/conf.d/default.conf

2. And then we added the following line of codes to the file.

server {
listen 80;
server_name x.x.x.x;
return 301 https://$server_name$request_uri;}

3. Finally, we restarted the Nginx service.

systemctl restart nginx

Now, the user could access Webmin and he no more gets an error like “400 Bad Request: The plain HTTP request was sent to HTTPS port”.

That’s how we fixed the problem.

Thank for reading this article.

Was this helpful?

1 / 0

Leave a Reply 5

Your email address will not be published. Required fields are marked *



What’s Happening i’m new to this, I stumbled upon this I’ve found It absolutely helpful and it has helped me out loads. I hope to contribute & help other users like its aided me. Great job.

zortilo nrel

zortilo nrel

I got good info from your blog



Hey just wanted to give you a quick heads up. The words in your article seem to be running off the screen in Safari. I’m not sure if this is a formatting issue or something to do with browser compatibility but I figured I’d post to let you know. The design look great though! Hope you get the problem solved soon. Many thanks

Farah Cypress

Farah Cypress

I’m impressed, I must say. Seldom do I encounter a blog that’s equally educative and entertaining, and without a doubt, you’ve hit the nail on the head. The problem is an issue that too few people are speaking intelligently about. I’m very happy I came across this during my hunt for something regarding this.



I do agree with all the ideas you have offered for your post. They are really convincing and will certainly work. Still, the posts are too short for starters. May you please extend them a bit from next time? Thanks for the post.