Comments (8)
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.
There seems to be config example here
https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
from wordpress-skeleton.
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.
Awesome I really wish we connect varnish and keep SPDY
from wordpress-skeleton.
Had an issue accessing network admin menus. The above helped, as did this… open bug on WP core:
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.
Had the same problems as above with rewrites, subdomain install and domain mapping.
I did the following:
- Dropped sunrise.php in /content
- 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.
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;
- http://example.com/wp-admin/ (inifinite redirect loop)
- 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.
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)
- Update to Wordpress 4.4.2
- wp_localize_script doesn't appear to work
- Cannot Access Uploads Directory HOT 2
- Help Starting HOT 2
- Woocommerce template overrides not working
- Differences from _s HOT 1
- Installation failed: Download failed. cURL error 60: SSL certificate problem: self signed certificate in certificate chain HOT 2
- Nginx [no multi site] HOT 3
- Can't Establish php database connection on MAMP HOT 1
- Changing symlinks for media files stored in /shared/ HOT 2
- Broken Customizer After Migration
- '/content' directory not found beside '/wp' directory (get_template_directory_uri) HOT 1
- normalize.css doesn't appear here. Why? HOT 1
- How to change language of site and admin dashboard? HOT 1
- Repeated 403 console error when changing siteurl
- Update WP Skeleton to 4.2 Please HOT 1
- Multisite note HOT 7
- Problem loading theme assets HOT 1
- Question: Multisite, local (XAMPP) install
- MAMP/LAMP Multisite issues with my imported DB
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wordpress-skeleton.