WordPress.org

Ready to get started?Download WordPress

Forums

nginx - Network admin pointing to root as opposed to subdirectory (85 posts)

  1. hgrianevans
    Member
    Posted 1 year ago #

    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.

  2. You cannot (yet) run WP out of a subdirectory and have Multisite :(

  3. hgrianevans
    Member
    Posted 1 year ago #

    But didn't you and I discuss this over here? http://wordpress.org/support/topic/multisite-and-non-root-install?replies=6#post-3099122

    I asked "Can I install WP in, say, /blogs and have my various blogs as /blogs/blog1, /blogs/blog2, etc?"

    to which you replied "Sure, just install WP in the folder /blogs" along with other notes.

    Please don't say I've wasted a few hours...

  4. That's true.

    But you can't have http://www.example.com/wp-admin/network/ if WP is in http://www.example.com/blogs/

    Where are your files located on your server? In /blogs/ right?

    And you had WP as a single install running from /blogs with the URL of example.com/blogs?

  5. hgrianevans
    Member
    Posted 1 year ago #

    I just installed it today. Clean install.

    So the WP install is in /blogs. Admin is at /blogs/wp-admin/

    But Network Admin menu is pointing to /wp-admin/network/ instead of
    /blogs/wp-admin/network/

    Also, Network Admin->Visit Sites is pointing to our site's root, instead of /blogs

  6. That's very odd. It sounds like you accidently set it up to run out of root.

    When you install WP, you had both the home URL and site URL pointing to example.com/blogs, right?

  7. hgrianevans
    Member
    Posted 1 year ago #

    Right now I'm blanking. Would I have set that when I was editing wp-config? Or was that in a form in the install.

    Brand spanking new install so I can start again from scratch...what would I need to do...just drop the tables?

  8. Drop the tables and you may as well nuke the files as well.

    Copy a fresh version of WP to domain.com.blogs/

    Start from there (and do make the site domain.com, without the www, to avoid otehr issues)

  9. hgrianevans
    Member
    Posted 1 year ago #

    Is the without 'www' a huge issue? Our server config automatically redirects all example.com views to http://www.example.com to avoid issues with Google and duplication.

  10. It can be.

    I'll put it this way - I've never seen upgrade problems with non-www sites, but I have seen them with www ones :/

  11. hgrianevans
    Member
    Posted 1 year ago #

    Sorry for the break...was covering the Toronto Film Festival.

    Did a reinstall and both the WordPress address and Site address are pointing to example.com/blogs

    When I did the Network install the options for wp-config were:

    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);

    While Network->Visit Site is pointing to example.com/blogs, Network->Edit Site is pointing to:

    example.com/wp-admin/network/site-info.php?id=1

    What's the next step to make it point to example.com/blogs/wp-admin/network/site-info.php?id=1 instead?

    Also the My Sites->Network Admin links are all pointing to the domain's root and not /blogs

    Thanks.

  12. What's the next step to make it point to example.com/blogs/wp-admin/network/site-info.php?id=1 instead?

    If you want your URLs to be domain.com/blogs, you install in domain.com/blogs

    We went over the part where you cannot (yet) run WP out of a subdirectory and have Multisite, right?

  13. hgrianevans
    Member
    Posted 1 year ago #

    Okay, I think we're beginning to talk at cross purposes here.

    We went over the part where you cannot (yet) run WP out of a subdirectory and have Multisite, right?

    Yes, you mentioned that, but in that case I don't get your previous answers in http://wordpress.org/support/topic/multisite-and-non-root-install?replies=6#post-3099122

    To retiretate, as I did above, I asked "Can I install WP in, say, /blogs and have my various blogs as /blogs/blog1, /blogs/blog2, etc?"

    You said, "Sure, just install WP in the folder /blogs" and followed that up with "So if you install WordPress in domain.com/blogs/, then the main site is domain.com/blogs/ and the subsites are domain.com/blogs/site2 and so on."

    So I installed WP in domain.com/blogs

    It works. I follow the instructions to set up a network. That works. But there's an error in the admin links. They point to wp-admin in domain.com, a subdir that does not exist, and not wp-admin in the domain.com/blogs directory, a subdir that does exists.

    So I guess the crossed wires in the understanding occurs here. If you say "you cannot (yet) run WP out of a subdirectory and have Multisite" then how can you suggest that I can run multiple blogs in http://wordpress.org/support/topic/multisite-and-non-root-install?replies=6#post-3095243 by saying "So if you install WordPress in domain.com/blogs/, then the main site is domain.com/blogs/ and the subsites are domain.com/blogs/site2 and so on."

    So I guess the ultimate question here is why tell me "the main site is domain.com/blogs/ and the subsites are domain.com/blogs/site2 and so on" if that's not the case and the admin urls in the dashboard don't allow it.

    I'm not meaning to be difficult. I'm just trying to understand how there are two contradictory answers to the question.

    Thanks.

  14. If you install domain.com/blogs then your main URL will forever be domain.com/blogs

    You cannot use domain.com in that setup. There will not be a domain.com/WP-admin folder, ever.

    So when you keep saying you're poking at that, I have to come back and say no. You need to go to domain.com/blogs/WP-admin, because you cannot have WP in domain.com/blogs and use that to control domain.com - that is what I mean when I say you can't have it in a subdirectory like you do single site install.

    Now, if something is sending you to the domain.com/wp-admin URL then what is that something? You just say there's a link :) there are lots of links.

  15. hgrianevans
    Member
    Posted 1 year ago #

    If you install domain.com/blogs then your main URL will forever be domain.com/blogs

    I know that. We discussed that. I don't want anything to be in domain.com and there isn't anything in domain.com. What I said was that there are links that are pointing to /wp-admin in the dashboard instead of /blogs/wp-admin

    Now, if something is sending you to the domain.com/wp-admin URL then what is that something? You just say there's a link :) there are lots of links.

    Mika, I specifically did mention the links that are pointing incorrectly to domain.com. Look 4 messages up, the one that mentions the festival. I say:

    While Network->Visit Site is pointing to example.com/blogs, Network->Edit Site is pointing to:

    example.com/wp-admin/network/site-info.php?id=1

    Other incorrect URLS on the dashboard strip at the top:

    My Sites->Network Admin is pointing to domain.com/wp-admin/network/

    Next to that series of links, under the name of my Blog Network, Visit Site points to domain.com/blogs but Edit Site points to domain.com/wp-admin/network/site-info.php?id=1 where it should be pointing to domain.com/blogs/wp-admin/network/site-info.php?id=1

    Another issue: If I manually enter the URL domain.com/blogs/wp-admin/network/site-info.php?id=1 it incorrectly says the main site is at:

    Domain https://domain.com
    Path /

    I hope this clears things up. WordPress is installed in /blogs. I do not want/expect/think anything should be in /, but somewhere/somehow WP is creating links and configurations that point to /.

    I don't know where our misunderstanding is coming from. You keeping saying things like "You cannot use domain.com in that setup. There will not be a domain.com/WP-admin folder, ever." I don't expect there to be. It's WP that is pointing to URLs in the server root, and I cannot stress enough that based on the installation, I know/expect that everything should be under /blogs. But it's WP that's creating the wrong links.

  16. While Network->Visit Site is pointing to example.com/blogs, Network->Edit Site is pointing to:

    example.com/wp-admin/network/site-info.php?id=1

    What's the next step to make it point to example.com/blogs/wp-admin/network/site-info.php?id=1 instead?

    Also the My Sites->Network Admin links are all pointing to the domain's root and not /blogs

    Okay, please be patient with me :) You have a LOT of text going on and some of the earlier stuff (spread across two posts) was unclear. (Also my apologies, last night I was fresh off a plane.)

    To clarify, are you saying that ALL of your Network Admin links point to domain root? Because that indicates you did exactly what I said not to, which is part of why I keep reiterating it. Basically, WP is stupid :) It can't know a place exists unless you tell it ;)

    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?

    Also this:

    $base = '/';

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

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

  17. hgrianevans
    Member
    Posted 1 year ago #

    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.

  18. 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.

  19. hgrianevans
    Member
    Posted 1 year ago #

    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?

  20. 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...

  21. hgrianevans
    Member
    Posted 1 year ago #

    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?

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

  23. hgrianevans
    Member
    Posted 1 year ago #

    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.

  24. hgrianevans
    Member
    Posted 1 year ago #

    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.

  25. 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?

  26. hgrianevans
    Member
    Posted 1 year ago #

    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.

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

    What's in your conf file for nginx?

  28. hgrianevans
    Member
    Posted 1 year ago #

    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.

  29. 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.

  30. hgrianevans
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic