Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Let's Encrypt create/renew with force-https template

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
19 posts
  • 1
  • 2
  • Next
ThA-LaN-LaW
Posts: 14
Joined: Mon Jan 25, 2016 2:25 pm

Let's Encrypt create/renew with force-https template
  • Quote

Post by ThA-LaN-LaW » Wed Feb 22, 2017 4:10 pm

Hi,

the vesta-cp let's encrypt plugin is great! good job!

if we use let's encrypt with proxy Template: force-https (from here: https://vestacp.com/docs/#how-to-force-https)
let's encrypt could not renew or create the certificate because the .well-know path/directory is not accessible.

my preferred way is to edit or create a new template (proxy or web?) with the .well-known entry.
something like:

Code: Select all

    location /.well-known {
        alias %home%/%user%/web/%domain%/.well-known;
    }
or

Code: Select all

    location '/.well-known/acme-challenge' {
        default_type "text/plain";
        root /usr/local/vesta/data/queue/letsencrypt.pipe;
    }
any hints or suggestions?

best regards!
Top

ThA-LaN-LaW
Posts: 14
Joined: Mon Jan 25, 2016 2:25 pm

Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by ThA-LaN-LaW » Thu Feb 23, 2017 8:18 am

got it: vesta includes the letsencrypt config...

Code: Select all

include /home/user/conf/web/nginx.userdomain.com.conf*;
this one is missing in the force-https templates and causes

Code: Select all

Error: Invalid response from http://..... /.well-known/acme-challenge....../SOMERANDOMKEY
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by skurudo » Wed Mar 29, 2017 9:11 am

Do you mean need to include nginx.domain.com.conf_letsencrypt file too?
Top

locus
Posts: 63
Joined: Thu May 05, 2016 6:43 am

Os: Ubuntu 15x
Web: apache + nginx
Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by locus » Tue Apr 11, 2017 4:52 am

Is it OK to include both so the LE .conf gets included?

Code: Select all

include %home%/%user%/conf/web/s%proxy_system%.%domain%.conf*;
include %home%/%user%/conf/web/%proxy_system%.%domain%.conf*;
Top

locus
Posts: 63
Joined: Thu May 05, 2016 6:43 am

Os: Ubuntu 15x
Web: apache + nginx
Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by locus » Tue Apr 11, 2017 6:31 am

That change seemed to work for me - certs renewed.
Top

Trentor
Posts: 84
Joined: Fri Apr 25, 2014 6:42 pm

Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by Trentor » Thu Apr 13, 2017 4:47 pm

if we use let's encrypt with proxy Template: force-https let's encrypt could not renew or create the certificate because the .well-know path/directory is not accessible.
Hi,

Is this a confirmed bug?

I use the https template and I had problems in the past to renew the Let's Encrypt certificates. My server is again configured the same way and I wouldn't like to have one more time the same problem.

Thanks.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by skurudo » Mon Apr 24, 2017 5:41 pm

Fix for force-https templates:

/usr/local/vesta/data/templates/web/nginx/force-https.tpl

Code: Select all

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    location / {
        rewrite ^(.*) https://%domain_idn%$1 permanent;
    }
include %home%/%user%/conf/web/*nginx.%domain_idn%.conf_letsencrypt;
}
/usr/local/vesta/data/templates/web/nginx/force-https.stpl

Code: Select all

server {
    listen      %ip%:%proxy_ssl_port% ssl;
    server_name %domain_idn% %alias_idn%;
    ssl         on;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;
    error_log  /var/log/%web_system%/domains/%domain%.error.log error;

    location / {
        proxy_pass      https://%ip%:%web_ssl_port%;
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           %sdocroot%;
            access_log     /var/log/%web_system%/domains/%domain%.log combined;
            access_log     /var/log/%web_system%/domains/%domain%.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      https://%ip%:%web_ssl_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include %home%/%user%/conf/web/*nginx.%domain_idn%.conf_letsencrypt;

    include %home%/%user%/conf/web/s%proxy_system%.%domain%.conf*;
}
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by skurudo » Tue Apr 25, 2017 8:32 am

force-https template updated
Top

Trentor
Posts: 84
Joined: Fri Apr 25, 2014 6:42 pm

Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by Trentor » Tue Apr 25, 2017 9:33 am

skurudo wrote:force-https template updated
I downloaded the templates from "Documentation" and still be the old ones.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Let's Encrypt create/renew with force-https template
  • Quote

Post by skurudo » Tue Apr 25, 2017 1:16 pm

Trentor wrote:I downloaded the templates from "Documentation" and still be the old ones.
From here? https://vestacp.com/docs/#how-to-force-https
Nope, I disagree

There is now one more include for Let's encrypt:

Code: Select all

include %home%/%user%/conf/web/*nginx.%domain_idn%.conf_letsencrypt;
Top


Post Reply
  • Print view

19 posts
  • 1
  • 2
  • Next

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password