0

My website is hosted on 6-cylinder.com and I decided to add a wordpress blog which is in a completely different VPS. So, I used proxy to list my blog as a subdirectory of my main domain So the final product should be 6-cylinder.com/blog

The proxy is working completely fine except for one file only!!!!!

wp-admin/ajax.php

This is the error message in chrome console enter image description here

Here is what I added to my wp-config.php

$_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/",  $_SERVER['REQUEST_URI']);

define( 'WP_SITEURL', 'http://6-cylinder.com/blog' );
define( 'WP_HOME', 'http://6-cylinder.com/blog' );

and here is the proxy code in the nginx file

location ^~ /blog/ {
  proxy_pass http://139.59.211.216/;
  proxy_set_header X-Original-Host $host;
  proxy_set_header X-Is-Reverse-Proxy "true";
  proxy_pass_header Set-Cookie;
  proxy_cookie_path / /blog/;
 }
2
  • Is there a reason you cannot host the backend at http://139.59.211.216/blog/ and avoid all of the rewriting between / and /blog/? Commented Aug 16, 2016 at 8:59
  • No I never even thought of that. Can you elaborate more? Commented Aug 16, 2016 at 12:17

1 Answer 1

0

The time i had problems with wp-admin the solution was to add the folowing line to the wp-config.php:

$_SERVER['HTTP_HOST']=$_SERVER['HTTP_X_FORWARDED_HOST'];

(wordpress behind nginx proxy (acces from two sources))

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.