(Solved)Wordpress problem with NGINX config in different docroot

Discussion in 'Installation/Configuration' started by degoya, Jun 4, 2024.

  1. degoya

    degoya New Member

    i try to setup a wordpress with a different root folder /releases/test/ inside the default ispconfig web folder.

    first i've tried this so far, found something here in the forum and modified to my needs:

    Code:
    location / {
    root {DOCROOT}releases/test;
    index index.php;
    try_files $uri $uri/ /index.php?$query_string /releases/test/index.php?$query_string;
     } 
    this resulted in a 404 error.

    After searching google and trying around i came to this solution.
    Code:
    location / {
       root {DOCROOT}/releases/test/;
        try_files /releases/test/$uri /releases/test/$uri/ /releases/test/index.php?$query_string;
    }
    
    This works for the delivery of the index.php from the {DOCROOT}/releases/test/ folder. But with a new install i get redirected in the browser to www.mydomain.com/wp-admin/setup-config.php and this results in a 404 error.

    now i tested this after finding something in the forum
    Code:
    ##merge## root {DOCROOT}/releases/test/;
    
    location / {
        try_files $uri $uri/ index.php?$query_string;
    }
    
    But this only removes ##merge## root {DOCROOT}/releases/test/; from the config and doesn't replace the root in the config.

    My Questions:
    - do i need to have another rewrite for the wp-admin folder? If yes, how?
    - are there any other rewrites i need to get the WP installation running with a different webroot?
    - does anybody got a NGINX Config for WP with different docroot he could share with me?

    thanks for your help!
     
    Last edited: Jun 4, 2024
  2. degoya

    degoya New Member

    Solution:
    Code:
    ##subroot releases/test/ ##
    
    location / {
        try_files $uri $uri/ index.php?$query_string;
    }
     
    ahrasis and till like this.

Share This Page