Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: multisite with subdirectories 404 on subsite wp-includes folder #2569

Open
pdewouters opened this issue Jan 5, 2022 · 2 comments
Open

Comments

@pdewouters
Copy link

I have setup a new site with VVV, with the following config

  my-site:
    skip_provisioning: false
    description: "My Site"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - mysite.test
    custom:
      public_dir: site/public
      wp_type: none

I followed these steps:

  • first copied the "wordpress-one" config and provisioned to have a default working WP install
  • modified the config to the above, created the site directory and git cloned my existing repo into it. This contains a custom content and wp folders under a public directory. It uses an .env file for the WP constants such as WP_HOME, WP_SITEURL...
  •  update the database values for home and siteurl and blogs table urls.

So I'm able to view the main site and visit the admin, but the network admin is a 404 - it is missing the /wp/ part - if I add that manually I can access the network admin. And the other issue is that when I load a subsite, the path to wp-includes is a 404 too. e.g. http://mysite.test/subsite/wp-includes/js/dist/wordcount.js?ver=83b86052fd3fc408a609e60d52164115

The generated nginx config:

server {
    listen       80;
    listen       443 ssl http2;
    server_name  {vvv_hosts};
    root         "{vvv_path_to_site}/site/public";

    # Nginx logs
    error_log    "{vvv_path_to_site}/log/nginx-error.log";
    access_log   "{vvv_path_to_site}/log/nginx-access.log";

    # This is needed to set the PHP being used
    set          $upstream {upstream};

    # Enable server push if SSL/HTTP2 is being used for link preload headers
    http2_push_preload on;

    {vvv_tls_cert}
    {vvv_tls_key}

    # Nginx rules for WordPress, rewrite rules, permalinks, etc
    include      /etc/nginx/nginx-wp-common.conf;



    location ~* \.(css|eot|gif|ico|jpeg|jpg|js|png|svg|tiff|tiff|ttf|webp|woff|woff2)$ {
        expires 100d;
    }
}

Thanks!

@tomjn
Copy link
Member

tomjn commented Jan 5, 2022

I'm a little confused, the config you shared would give mean that /srv/www/my-site/public/site/info.php = https://mysite.test/info.php. What you then do in that folder is entirely up to you, the closest VVV gets to touching it is the nginx config file, so unless there is an Nginx configuration issue I don't see the issue ( assuming a standard WordPress layout ).

If you're trying to do weird things with the folders then you'll need to change the nginx config accordingly, but I don't see how the Nginx config VVV already uses.

Can you separate this out into discrete parts?

It uses an .env file for the WP constants such as WP_HOME, WP_SITEURL...

VVV does not use these, besides once VVV provisions a site and installs WordPress it's done, WordPress provisioning only happens once, changing values in config.yml won't do things like change the admin user/pass or downgrade/upgrade WordPress.

So I'm able to view the main site and visit the admin, but the network admin is a 404 - it is missing the /wp/ part

Nothing to do with VVV, this is the application layer, VVV doesn't load code into WordPress. The exception is when we load a tideways library via a PHP ini, but that doesn't use or contain WordPress APIs and is purely for profiling if it's turned on

And the other issue is that when I load a subsite, the path to wp-includes is a 404 too. e.g. http://mysite.test/subsite/wp-includes/js/dist/wordcount.js?ver=83b86052fd3fc408a609e60d52164115

A WordPress 404 or an Nginx 404? Is this a normal multisite URL? I don't see anything that would change this from the VVV end.

The generated nginx config:

This looks like a half generated Nginx file, did you get this from the /etc/nginx folder?

@pdewouters
Copy link
Author

Thanks @tomjn :)
Ignore that nginx config, I think I need to create a vvv-nginx-custom.conf and define some rules there because WordPress core is in a subdirectory site/public/wp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants