WP/Apps Installed (subdir) & 404 Errors on internal pages

Discussion in 'ISPConfig 3 Priority Support' started by markelino, Sep 17, 2019.

  1. markelino

    markelino New Member HowtoForge Supporter

    Hello

    Had an issue after setting latest ISPconfig (nginx setup) on my server and trying to add WordPress installations to a subdirectory (that ISPconfig supports via its app installation approach) such as demo1, demo2… after I had created a main domain as such: sites.domain.com with LE SSL.

    So I created multiple new WP installs under sites.domain.com as (as portfolios):
    sites.domain.com/demo1
    sites.domain.com/demo2
    sites.domain.com/demo3

    Glad all worked and all under the SSL of the main domain. Only to find out any inner wordpress pages (besides home page) caused 404 errors.
    Disabled in ISPconfig option: “Own Error-Documents”
    only to see from going to IpsConfig 404 pages to the white ngnix 404 page.

    Checked .htaccess on site.domain.com and all that is in there is:
    # BEGIN MainWP
    # END MainWP
    since I tried to setup MainWP to help me manage these planned sites.

    Tried adding this directive:
    Code:
    location / {
    if (!-e $request_filename){
    rewrite ^(.*)$ /index.php break;
    }
    }
    then did a service nginx restart
    but problems persisted ;(
    (note this is not a WP multisite – as each install within dir is its own standard WP install.)

    When wordpress permalinks are set to plain, 404 errors went away, but not for post types.

    sites.domain.com has no app/wp installed (client0). All /demo1, demo2 only have WP installed as client0.

    Any tips to try, appreciated.
    Thank you
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You use nginx as web server, nginx does not support the .htaccess file that ships with wordpress, this means that you have to add nginx config for each website in the nginx directives field of the websites options tab.

    For a wp in the webroot, you would use this:

    Code:
    location / {
                   try_files $uri $uri/ /index.php?$args;
    }
    
    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    
    location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                   expires max;
                   log_not_found off;
    }
    
    For your case, you will have to add such a blog for each of the wp installs but use the right relative path in the location, try files and rewrite statements.
     

Share This Page