Nginx directive is not accepting

Discussion in 'Installation/Configuration' started by ASchmidt, Jan 18, 2026.

  1. ASchmidt

    ASchmidt New Member

    Hi.
    I have reinstalled the newest version of ispconfig (twice) with automation script - nginx.
    I setup a client, a website, a database, FTP User.
    On the website i use a subdomain with ssl (work fine). In the option i added
    Code:
    location / {
        root {DOCROOT}public;
        index index.php index.html;
        try_files $uri /index.php?$query_string;
    }
    
    location ~ \.php$ {
        root {DOCROOT}public;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass {FASTCGIPASS};
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    Always getting a 403 on hitting the domain with tld.
    Is this happend already before?
    Installed was ninja invoice on the webhost.

    Thank you.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Your problem is not an ISPConfig installation or configuration issue, so reinstalling can not help, as nothing is broken on your system. The reason for your problem is that you created an invalid custom config; generally, you can not change the Docroot in Nginx by redefining the root directive; Nginx does not support that. To change the docroot of a website, use subroot. See e.g. post #13 and #14 here:

    https://forum.howtoforge.com/threads/changing-root-directory.82357/#post-390647
     
  3. ASchmidt

    ASchmidt New Member

    @till thanks for the link. I added ##subroot public/ ##; but their is still a 403
    Code:
    
    location / {
    ##subroot public/ ##;
        index index.php index.html;
        try_files $uri /index.php?$query_string;
    }
    
    location ~ \.php$ {
        ##subroot public ##;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass {FASTCGIPASS};
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    
    THe error looks still this
    Code:
    2026/01/18 17:29:28 [error] 523137#523137: *16 directory index of "/var/www/DOMAIN/web/" is forbidden, client: *.*.*.*, server: DOMAIN.com, request: "GET / HTTP/2.0", host: "DOMAIN.com"
    
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I wonder why you redefined the PHP location? ISPConfig manages PHP, so I don't think that's necessary. Also, I don't think you should put the root into a location. Try e.g.:

    Code:
    ##subroot public/ ##;
    
    location / {
        index index.php index.html;
        try_files $uri /index.php?$query_string;
    }
     
  5. ASchmidt

    ASchmidt New Member

    Okay I did. I get the location directives from an internet search.
    With this i get an error an in my log this.
    Code:
    2026/01/18 17:49:12 [error] 526555#526555: *69 openat() "/var/www/DOMAIN/web/public/error/404.html" failed (2: No such file or directory), client: *.*.*.*, server: DOMAIN, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/web3.sock", host: "DOMAIN.com"
    2026/01/18 17:49:12 [error] 526555#526555: *69 rewrite or internal redirection cycle while internally redirecting to "/error/404.html", client: *.*.*.*, server: DOMAIN.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/web3.sock", host: "DOMAIN.com"
    
     
  6. ASchmidt

    ASchmidt New Member

    Okay dont keep it in mind. Disable own error pages :/
    Thank you
     

Share This Page