Mastering Nginx

(Ron) #1
Chapter 4

[ 83 ]

proxy_pass http://127.0.0.1:8080;
}

This configuration can be illustrated by the following diagram:


Another example of an "if"-fy configuration is the following:


server {

server_name marketing.example.com communication.example.com
marketing.example.org communication.example.org marketing.example.
net communication.example.net;

if ($host ~* (marketing\.example\.com|marketing\.example\.
org|marketing\.example\.net)) {

rewrite ^/$ http://www.example.com/marketing/application.do
redirect;

}

if ($host ~* (communication\.example\.com|communication\.example\.
org|communication\.example\.net)) {

rewrite ^/$ http://www.example.com/comms/index.cgi redirect;
Free download pdf