Nginx – Adding backend servers and redirection

Following configuration file will reside in “/etc/nginx/config.d/”folder as described in this post Click here! This configuration will give an idea on how to listen on port 443 for SSL connections and redirect the requests to backend servers. I have also added an example to manipulate HTML contents coming form backend server on the fly using subs_filer.

server {
listen 443;
ssl on;

server_name www.computer-press.com;
ssl_certificate conf/name_combined.crt;
ssl_certificate_key conf/name.com.key;

location / {
proxy_pass https://www1.computer-press.com.com/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect https://this_link.computer-press.com/ https://to_this.computer-press.com/;
proxy_redirect https://this_link.computer-press.com/ https://to_this.computer-press.com/;

# In free version sub_filer is not available out of the box, but you can download the source code and compile it with very easy steps. subs_filter is used to manipulate the html contents/links on the fly on web site 🙂 you can replace anything with whatever you want.
subs_filter https://change_this.computer-press.com https://to_this.computer-press.com;
subs_filter https://and_this.computer-press.com https://to_this.computer-press.com;
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *