WordPress.org

Support

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

nginx – Network admin pointing to root as opposed to subdirectory

  • hgrianevans

    @hgrianevans

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

    All my main site links point to example.com/blogs, but when I go to network admin the links point to http://www.example.com/wp-admin/network/ instead of http://www.example.com/blogs/wp-admin/network/

    Here’s the multisite section in my config:

    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    $base = '/blogs';
    define('DOMAIN_CURRENT_SITE', 'www.example.com');
    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.

    Thanks.

Viewing 15 replies - 16 through 30 (of 84 total)
  • hgrianevans

    @hgrianevans

    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 domain.com as the domain, and ‘/blogs/’ as the path – does it?

    points to domain.com 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 domain.com/blogs/wp-admin/install.php 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’, ‘example.com’);
    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.

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    points to domain.com and /

    Well that’s wrong.

    Should be domain.com and /blogs/

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

    hgrianevans

    @hgrianevans

    How on earth did that get goofed? WP totally thinks it’s in domain.com, 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?

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    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 domain.com/blogs/’ 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…

    hgrianevans

    @hgrianevans

    and tell it ‘My home and site URLs are domain.com/blogs/’

    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?

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    No. It knows ‘I am in domain.com/blogs/’

    (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.)

    hgrianevans

    @hgrianevans

    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.

    hgrianevans

    @hgrianevans

    Just did another completely clean install of WP.

    This time General Settings showed home and site urls as domain.com/blogs

    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.

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    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?

    hgrianevans

    @hgrianevans

    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.

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

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

    What’s in your conf file for nginx?

    hgrianevans

    @hgrianevans

    location ^~ /blogs {
    try_files $uri /blogs/index.php?q=$uri;
    location ~ \.php$ {
    fastcgi_pass 127.0.0.1:10004;
    }
    }

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

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    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 http://wiki.nginx.org/WordPress 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.

    hgrianevans

    @hgrianevans

    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 http://wordpress.org/support/topic/migrating-database-driven-site-to-wp?replies=1 I could look at moving the whole shebang to WP.

    hgrianevans

    @hgrianevans

    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.