Score:0

Nginx proxy pass issue

ga flag

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;
}

}

in flag
Most probably it's your backend server that is doing the redirect, not nginx.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.