Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

configure /etc/nginx/nginx.conf to redirect to separate host

$
0
0
Does anyone know how to modify the nginx.conf file to redirect to another host? I would like to direct http://mydomain.com/page1 and http://mydomain.com/page2 to separate hosts on my local network. mydomain.com/page1 should go to 10.100.0.163 and mydomain.com/page2 should go to 10.100.0.164.

Here is what I added to the HTML section of the nginx.conf file on my Ubuntu server.

==================
location /page1/ {
rewrite ^/page1/(.*)$ http://10.100.0.163/$1 permanent;
}

location /page2/ {
rewrite ^/page2/(.*)$ http://10.100.0.164/$1 permanent;
}
==================

Is there anything else I need to add to the nginx.conf file? Are there any other configuration files I also need to modify?

I just did a standard install of nginx and haven't changed anything else.

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>