nginxhttpsvesta

How to force https for a domain in Vesta control panel?


How to force https for a domain in Vesta control panel? The Vesta docs give the following instructions. However, after following them, in the Vesta control panel > packages > default > edit > in Web Template NGINX dropdown force-https does not appear and so cannot be selected. Any help would be greatly appreciated.

1. Install custom nginx template

cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/rhel/force-https/nginx.tar.gz
tar -xzvf nginx.tar.gz
rm -f nginx.tar.gz

3. Create new package or set force-https as nginx template in the existing package
4. Add new user and assing him package with force-https template
5. Add new domain with SSL certificate and check the result
``

Solution

  • Run the below command after making the changes. It will make the change appear in the packages settings ... packages > default > edit > Proxy Template NGINX. Replace USER with your server user

     /usr/local/vesta/bin/v-rebuild-user USER 
    

    this command will rebuild user Configuration and can overrite your custom configuration

    Here is a link to a different implementation https://medium.com/thepolarlab/apply-ssl-certificates-to-your-website-and-force-using-https-connections-37e481f7a29d