Giter VIP home page Giter VIP logo

Comments (8)

birgire avatar birgire commented on June 12, 2024 2

Here is what seems to work on my subdirectory multisite test install::

My directory structure is:

/
  content/
  wp/
  index.php
  wp-config.php

If you use for example the NginX rules proposed in the Codex, then you can try to replace this snippet:

# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
    rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}

with:

# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) /wp$1 last;
    rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ /wp$1 last;
}

Then after

nginx -t && service nginx reload

I can access urls like before:

www.example.com/wp-admin/
www.example.com/site1/wp-admin/
www.example.com/site2/wp-admin/
www.example.com/site1/wp-admin/edit.php
www.example.com/site2/wp-admin/edit.php

without the /wp/ part in the url.

The /wp/ part will not work on the sub sites:

 www.example.com/site2/wp/wp-admin/
 www.example.com/site2/wp/wp-admin/edit.php

but it will work on the main site:

www.example.com/wp/wp-admin/
www.example.com/wp/wp-admin/edit.php

I've only applied this on my test setup so I will have to play with it some more before trying this out in the real world ;-)

from wordpress-skeleton.

ilibilibom avatar ilibilibom commented on June 12, 2024 2

There seems to be config example here
https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/

from wordpress-skeleton.

tmort avatar tmort commented on June 12, 2024

To anyone who may have a similar problem, the only solution I've found thus far is to put WordPress in the root directory, taking it out of the wp subfolder (which causes problems using WordPress Skeleton for updates, etc).

I've narrowed it down to an NGINX config issue, just haven't solved it. Will post it here if I find something.

from wordpress-skeleton.

blueprintmrk avatar blueprintmrk commented on June 12, 2024

Awesome I really wish we connect varnish and keep SPDY

from wordpress-skeleton.

coreyp avatar coreyp commented on June 12, 2024

Had an issue accessing network admin menus. The above helped, as did this… open bug on WP core:

http://wordpress.org/support/topic/network-admin-menu-links-broken-on-35-subdomain-multisite-install-subfolder?replies=7

Relevant section:

"- edit wp-includes/link-template.php func network_admin_url(), edit the line"

$url = network_site_url('yourfolder/wp-admin/network/', $scheme);

Navigation between network admin pages and subsites and subsite admin pages all works as expected after making that change to core… if you dare. (I forked the WP submodule for now, which works just fine as a minor tweak to the default skeleton setup.)

from wordpress-skeleton.

kjprince avatar kjprince commented on June 12, 2024

Had the same problems as above with rewrites, subdomain install and domain mapping.

I did the following:

  1. Dropped sunrise.php in /content
  2. Used the hack above and edited network_site_url in the link-templates.php file

Looks good so far.

So this may help anyone thats interested:

https://core.trac.wordpress.org/ticket/19796

Also related

https://core.trac.wordpress.org/ticket/23221

from wordpress-skeleton.

zanematthew avatar zanematthew commented on June 12, 2024

Hi, I've been using WP Skelton with Apache, for several years now. Recently decided to give nginx a try, and of course wanted to use WP Skelton. Thus far I'm stumped with the same issue as the original poster;

  1. http://example.com/wp-admin/ (inifinite redirect loop)
  2. http://example.com/wp/wp-admin/ (no CSS/JS)

Note, the following URLs do work:

I should be able to access the primary site as http://example.com/wp-admin/, and not http://example.com/wp/wp-admin/ (with no CSS/JS).

Can anyone point me in the right direction with the below nginx config? Note I am entirely new to ngnix, so any explanation would be greatly appreciated.

server {
    # also use www here
    server_name example.com;

    rewrite_log on;

    access_log /var/www/logs/access.log;
    error_log /var/www/logs/error.log;

    root /var/www/public/;
    index index.php;

    # Cache
    set $skip_cache 0;

    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
        set $skip_cache 1;
    }   
    if ($query_string != "") {
       set $skip_cache 1;
    }   

    # Don’t cache uris containing the following segments
    if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
        set $skip_cache 1;
    }   

    # Don’t use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
        set $skip_cache 1;
    }
    ## End Cache

    location / {
        try_files $uri $uri/ /index.php?$args; 
    }

#    I was playing around with this         
#    rewrite ^/(wp-.*.php)$ /wp$1 last;  
#    rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;

    # Rewrite multisite '.../wp-.*' and '.../*.php'.
    if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) /wp$1 last;
        rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ /wp$1 last;
    } 

    location ~ \.php$ {

        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

        # Caching (FastCGI) configuration
        fastcgi_cache_bypass $skip_cache;
        fastcgi_no_cache $skip_cache;
        fastcgi_cache WORDPRESS;
        fastcgi_cache_valid 60m;
    }

    # Caching (FastCGI) configuration
    location ~ /purge(/.*) {
        fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
    }

}

from wordpress-skeleton.

Daisuke-sama avatar Daisuke-sama commented on June 12, 2024

Hi,

I'd like to recommend you following the problem solving method through nginx config. So, you will have the access to all admin panels and network admin panel, as well.

Change your rewrites with following

if (!-e $request_filename) {
   rewrite ^/(wp-admin/.*)$ /wp/$1 last;
   rewrite ^/[_0-9a-zA-Z-]+(/wp-admin/.*)$ /wp/$1 last;

   rewrite /wp-admin$ $scheme://$host$uri/ permanent;
	
   rewrite ^/[_0-9a-zA-Z-]+(/wp-includes/.*) /wp/$1 last;
   rewrite ^/(wp-[^/]+\.php)$ /wp/$1 last;
   rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
   rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
rewrite ^/(wp-includes/.*)$ /wp/$1 last;

from wordpress-skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.