Subdomain doesn't work anymore

Discussion in 'Installation/Configuration' started by WolfgangPue, Apr 7, 2021.

  1. WolfgangPue

    WolfgangPue New Member

    Hi,
    I have a problem with the nginx configuration of my subdomains since november.
    For example my domain is: domain.tld
    The subdomain is a folder in my domain: static.domain.tld is the same like domain.tld/static/

    Host: static
    Domain: domain.tld
    Redirect Type: No flag
    Redirect Path: /static/
    Don't add to Let's Ecrypt certifcate: NO
    Active: YES

    When I create this subdomain the nginx config is as follows:

    Code:
    if ($http_host = "static.domain.tld") {
        rewrite ^(?!/(static|stats|\.well-known/acme-challenge))/(.*)$ /static/$1 ;
    }
    But with this configuration my subomain does not work. When I try to access the subdomain following error occurs: direct access directory forbidden

    The correct configuration is to replace the $1 with $2 and everything works fine. I have to use custom configs for nginx_vhost.conf.master everytime to run my domains properly.

    There was a commit in november 2020 which changed the $2 to $1: nginx vhost: exclude let's encrypt from rewrites

    https://git.ispconfig.org/ispconfig/ispconfig3/-/commit/acfb1ace2b5ab9cd0e614e01651380d66bc68837

    Old Code:
    Code:
    <tmpl_loop name="local_redirects">
            if ($http_host <tmpl_var name='local_redirect_operator'> "<tmpl_var name='local_redirect_origin_domain'>") {
                rewrite ^<tmpl_var name='local_redirect_exclude'>(.*)$ <tmpl_var name='local_redirect_target'>$2 <tmpl_var name='local_redirect_type'>;           
            }
    </tmpl_loop>
    New Code:
    Code:
    <tmpl_loop name="local_redirects">
            if ($http_host <tmpl_var name='local_redirect_operator'> "<tmpl_var name='local_redirect_origin_domain'>") {           
                rewrite ^<tmpl_var name='local_redirect_exclude'>(.*)$ <tmpl_var name='local_redirect_target'>$1 <tmpl_var name='local_redirect_type'>;
            }
    </tmpl_loop>
    I do not know why the part changed. I'm not sure if this is a bug or I configured it wrong.
    Maybe the error occurs because I use the automated ispconfig3 install:

    Code:
    cd /tmp; wget --no-check-certificate -O installer.tgz "https://github.com/servisys/ispconfig_setup/tarball/master"; tar zxvf installer.tgz; cd *ispconfig*; bash install.sh
    I would really appreciate it if you could tell me whats wrong.

    ISPConfig: 3.2.3
    PHP: 7.3
    nginx: 1.14.2
    Linux: Debian 10.9

    Best regards
    Wolfgang
     
    ahrasis likes this.
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    I don't think this causes the problem, but this script is not maintained. Use the official autoinstaller instead: https://www.howtoforge.com/community/threads/ispconfig-3-autoinstaller.86078/

    I think it should be $2, but I am not 100% sure. I'll try to find out ;)
     
  3. WolfgangPue

    WolfgangPue New Member

    For a new server I used the official autoinstaller instead. Same problem.
    Does no one have the same issue with the subdomains?
     
    ahrasis likes this.
  4. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    We found the bug and it will be fixed in 3.2.5, which is scheduled to release tomorrow!
    https://git.ispconfig.org/ispconfig/ispconfig3/-/issues/6144
     
    ahrasis and WolfgangPue like this.

Share This Page