Answer the question
In order to leave comments, you need to log in
How to set up redirects to the site?
Next situation.
We have:
Router connected to the Internet,
Server 1
Server 2
Servers are connected to the router.
On router 80, port forwarded to server 1, 8080 forwarded to server 2.
On server 1 LAMP and the only useful resource is a directory accessible to users via http.
On the server 2 LAMP and a website.
I would like:
So that when accessing the 80 port of the router, the site of server 2 opens, but at the same time the directory of server 1 remains available at the same address.
How to set up forwarding? Maybe from server 1 to server 2? or make server 2 the main one and redirect it to server 1? Or in general somehow to connect the directory of the server 1 to the server 2? How to do it technically?
Answer the question
In order to leave comments, you need to log in
how difficult did you come up with, but the usual options without difficulties are not an option?
<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="1; URL=http://domain.ru">
</HEAD>
<BODY>
</BODY>
</HTML>
<script language="JavaScript">
window.location.href = "http://domain.ru"
</script>
The solution to your problem lies in the proxy plane. I have not hung around with apache for a long time, but on nginx it would look something like this.
server {
listen 80;
server_name server2;
location /catalog {
proxy_pass http://server1;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question