ISPConfig3 / nginx / Wordpress / Letsencrypt / rewrite rule

Discussion in 'Installation/Configuration' started by RicochetPeter, Apr 9, 2019.

  1. RicochetPeter

    RicochetPeter Member

    Hi,
    I hope the subject of this thread already gives you a hint about what I want to ask.
    Situation: ISPConfig3, the webserver, Letsencrypt, all working fine.

    Now I have this rewrite rule for Wordpress:
    Code:
    if (!-e $request_filename) {
        rewrite ^(.+)$ /index.php?q=$1 last;
    }
    And this prevents Letsencrypt from automatically renewing the certificate. The routine is now to deactive the rewrite rule, renew the cert by disabling and enabling Letsencrypt in ISPConfig, then reenabling the rewrite rule.... not the way it's meant to be, actually...

    My question to anyone with more nginx/rewrite powers: could there be a way to modify this rewrite rule to make Letsencrypt work?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Use this instead:

    Code:
            location / {
                    try_files $uri $uri/ /index.php$is_args$args;
            }
    
            location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                    expires max;
                    access_log off;
                    log_not_found off;
            }
    That's the Nginx rewrite rule that is recommended by WordPress and it works fine on ISPConfig servers as well.
     
  3. RicochetPeter

    RicochetPeter Member

    thanks, Till, but any of these gives me
    upload_2019-4-9_17-46-13.png
    this error.

    using ISPConfig Version: 3.1.13, nginx/1.10.3, Ubuntu 16.04.6 LTS
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Does this document help?
    https://codex.wordpress.org/Nginx
    Found that among others using Internet Search Engines with
    Code:
    Nginx rewrite rule that is recommended by WordPress
     
  5. RicochetPeter

    RicochetPeter Member

    Last edited: Apr 9, 2019
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The rules I posted are for the nginx directives field in ispconfig, that field is on the options tab of the website. I guess you posted it into the rewrite rule field on the redirects tab and not into the nginx directives field.
     
    RicochetPeter likes this.
  7. RicochetPeter

    RicochetPeter Member

    thank you so much for the heads up, Till, that worked!
     

Share This Page