VestaCP Redirect HTTP to HTTPS Domain

After installing vestaCP i didn’t find any working guide as how to redirect HTTP traffic to HTTPS

Heres the solution

Step 1

Install SSL certificates for your domains using the Vestacp panel

Step 2

Redirect HTTP to HTTPS

If you’re running NGINX on VestaCP then the following will redirect all HTTP traffic to HTTPS

Create a new file at /home/admin/conf/web/ (replace admin with your VestaCP Username and in file name to your domain name)

Add the following codes:

if ($scheme = http) { return 301$request_uri; }

Replace with your own domain name.


Using if is evil i know that, if your site has extremely large number of visitors at a time then you need to find some other solution.

Leave a comment

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