0

I have two site the one is main.domain.com, two is two.domain2.com, domain2 is wordpress blog server in diffrent server that I want use main.domain.com/blog nginx proxy pass to and click the blog page no change the main.domain.com to two.domain2.com, is that can be accomplish?

the code below can only pass to home page, after click blog page domian will change to two.domain2.com.

server {
server_name main.domain.com;

root /export/htdocs;
expires 0 ;

index index.php index.html;


location  ^~ /blog/ {
    proxy_set_header Host "two.domain2.com";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass https://two.domain2.com/;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect off;
    proxy_set_header X-NginX-Proxy true;
    proxy_set_header Connection "";
}

location ~ \.php {
    include /etc/nginx/fastcgi_params;
}

}

0 Answers0