Support » Networking WordPress » nginx – Network admin pointing to root as opposed to subdirectory

  • Using nginx, I’ve installed WordPress to /blogs and enabled network sites.

    All my main site links point to, but when I go to network admin the links point to instead of

    Here’s the multisite section in my config:

    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    $base = '/blogs';
    define('DOMAIN_CURRENT_SITE', '');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

    If I tried changing PATH_CURRENT_SITE to /blogs, I’d get a db connection error.


Viewing 15 replies - 16 through 30 (of 84 total)
  • To clarify, are you saying that ALL of your Network Admin links point to domain root?

    Yes. The Links under My Sites->Network Admin->Dashboard, Sites, Users Visit Network all point to root.

    To the right, my network name points to /blogs. Visit Site points to /blogs, Edit Site points to root.

    Go into your database and look for the wp_site table. Yours should have as the domain, and ‘/blogs/’ as the path – does it?

    points to and /

    In your wp-config.php is wrong. That too should be $base = ‘/blogs/’;

    The wp-config changes are cut and pasted from what WP said to put in after I activated the network.

    Again, that’s a direct symptom of ‘installing in a subfolder, running in root.’

    Not clear on how this happened. After the 1st time I:
    – completely nuked WP database, dropped it entirely
    – rmdir’d the /blogs subdir
    – tar xvfz the latest wordpress
    – went to Install finished
    – added define(‘WP_ALLOW_MULTISITE’, true); to the wp-config and was given the following markup:

    define(‘MULTISITE’, true);
    define(‘SUBDOMAIN_INSTALL’, false);
    $base = ‘/’;
    define(‘DOMAIN_CURRENT_SITE’, ‘’);
    define(‘PATH_CURRENT_SITE’, ‘/’);
    define(‘SITE_ID_CURRENT_SITE’, 1);
    define(‘BLOG_ID_CURRENT_SITE’, 1);

    So if I installed in /blogs, why does WP keep thinking part of it is in root?

    Thanks again for all your help. I’m sure we both have forehead-shaped dents in our desks by now.

    points to and /

    Well that’s wrong.

    Should be and /blogs/

    How on earth did that get goofed? WP totally thinks it’s in, which is wrong.

    How on earth did that get goofed? WP totally thinks it’s in, which is wrong.

    Now we’re on the same page. 🙂

    Is there something I need to change/edit in wp-config before I run the install? A setting to force it to realize it’s installed in /blogs?

    Could it possibly be an ABSPATH issue?

    No, it’s literally that the settings you have are using an incorrect valie… Which is insane.

    Is there something I need to change/edit in wp-config before I run the install? A setting to force it to realize it’s installed in /blogs?

    Generally no. I mean when you put the WP files in /blogs/ and tell it ‘My home and site URLs are’ the info is hard-coded into your DB. It doesn’t rely on abspath ever.

    You could try manually changing it in your DB and wp-config…

    and tell it ‘My home and site URLs are’

    Just to clarify here. When I went to install.php in /blogs it never asked me for any URLs that I recall, just a name and admin account info. Should I have entered that anywhere?

    No. It knows ‘I am in’

    (I’ve done this install so many times, in subfolders and root, I’m very confident saying it can’t magically decide it’s in another folder unless, after installation, you actively went to the WP Admin -> General Settings, and changed the URLs there.)

    Ok, if I go to WP Admin -> General Settings, there are no URL options, just Site Title, Tagline, E-mail Address, Timezone, Date Format, and Week Starts On.

    Just did another completely clean install of WP.

    This time General Settings showed home and site urls as

    Added define(‘WP_ALLOW_MULTISITE’, true); to the /blogs/wp-config.php

    Again the suggested settings were:

    define(‘WP_ALLOW_MULTISITE’, true);

    and again the wp-site table showed the path as / instead of /blogs.

    So the problem seems to be at that part of the install network process.

    Yes, but the thing is… WordPress cannot possibly make up that path on its own.

    There’s GOT to be something absolutely weird in your wp-config that’s telling it that. How are you installing WP single site? Manually or via a one-click?

    I’ll tell you the exact steps:

    1) create the user and database in phpmyadmin
    2) add the database login info and secret/salt phrases to wp-config
    3) go to install.php (so this is one-click?)
    4) Voilà , I have a wordpress site. Add the wp_allow_multisite line, refresh.
    5) See the wrong links in site and wrong path in database
    6) Continue this thread. 🙂

    So, I repeat, I only touch the wp-config twice and it’s solely for database connect info & salt, followed by the wp_allow_multisite line. That’s it.

    Is there any sort of unix environment issue? We’re on an nginx server on a CentOS OS.

    No, that’s no one-click. (One click is like Fantastico or some other scripted install).

    What’s in your conf file for nginx?

    location ^~ /blogs {
    try_files $uri /blogs/index.php?q=$uri;
    location ~ \.php$ {

    Same config (different subdir) worked on a previous standalone install.

    location ^~ /blogs

    I’m like two weeks into nginx, but I think thats the problem. The conf is telling WP it’s really in the main folder. (The .htaccess for Multisite is different than single install, so I believe they’re different for nginx too)

    I was reading and it has a different explanation of how to do subfolders, and it has the multisite info, but I know every server’s a little different.

    I’m not sure I see how it’s telling WP it’s in the main folder as both the location and the index.php being pointed to are in /blogs.

    I’ll ask on the nginx mailing list to see if anyone knows.

    p.s. Looking at some of the nginx config examples, it seems it would be much easier if all of this was in the root, but as I’ve pointed out, my main non-wp site’s already there.

    I guess if I get an answer to I could look at moving the whole shebang to WP.

    Mika, I’m wondering…could WP be getting some variable inccorect through the fastcgi?

    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;

Viewing 15 replies - 16 through 30 (of 84 total)
  • The topic ‘nginx – Network admin pointing to root as opposed to subdirectory’ is closed to new replies.