nginx, Wordpress rewrite rule -> letsencrypt check fails

Discussion in 'Installation/Configuration' started by RicochetPeter, Aug 7, 2018.

  1. RicochetPeter

    RicochetPeter Member

    Hi folks,

    I have an Ubuntu 16.04 / ISPConfig 3.1 system, current patches, running with multiple web sites, all have letsencrypt certificates.
    The one site failing to renew its certificate is a Wordpress blog, which has the following rewrite rule in Options -> "nginx directives":
    Code:
    if (!-e $request_filename)
    {
    rewrite ^(.+)$ /index.php?q=$1 last;
    }
    This makes "pretty URLs" work for Wordpress (i.e. "https://the.site/the-blog-entry"), but it also prevents the ISPConfig check for "/.well-known/acme-challenge/[request-code].txt", as it runs into a 404.

    How can I still have the pretty URL rewrite working, but make an exception for the letsencrypt request?
    Thanks in advance for any ideas.
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    We normally just use this code in nginx directives to make it works without affecting Lets Encrypt:
    Code:
           location / {
               try_files $uri $uri/ /index.php?q=$uri&$args;
           }
    
     
    Jesse Norell likes this.

Share This Page