Answer the question
In order to leave comments, you need to log in
How to redirect from domainA.com to domainB.com/url?
Greetings!
There are 2 domains located on the same hosting. It is necessary that when going to domain1.com, the user sees the page domain2.com/page. The URL must remain domain1.com.
On the Nginx + NodeJS server.
So far, I've made it through nginx.conf so that domain1 looks at the same port as domain2 through proxy_pass.
I have no idea how to proceed.
Thank you for your help.
nginx.conf snippet
server {
listen IP:80;
server_name domain2.com;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen IP:80;
server_name domain1.com
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question