# Cheap SharePoint -\> Wordpress fail-over help request

**URL:** <https://www.ruby-forum.com/t/cheap-sharepoint-wordpress-fail-over-help-request/212697>\
**Category:** NGINX\
**Created:** [October 11, 2011, 11:41am UTC](https://www.ruby-forum.com/t/cheap-sharepoint-wordpress-fail-over-help-request/212697 "2011-10-11T11:41:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [October 11, 2011, 11:41am UTC](https://www.ruby-forum.com/t/cheap-sharepoint-wordpress-fail-over-help-request/212697/1 "2011-10-11T11:41:10Z")

</div>

We have nginx setup as a reverse proxy and on one of the backend servers  
we have a Sharepoint website that we want to failover to a Wordpress  
website hosted on another server if there’s a problem with Sharepoint  
website. I’ve googled and red through books etc but can’t we an example  
for this. I think i need “try\_files” and some type of error code  
checking but havent been able to figure it out. Could someone advice ?  
Below is the type of thing that I think I am after.

Thanks for looking.  
Keith

upstream primaryserver { server 10.1.1.1:80; }  
upstream secondaryserver { server 10.1.1.2:80; }

server  
{  
listen 80;  
server\_name \_;  
server\_name\_in\_redirect off;

```
 location /

```

{  
try\_files @sharepoint @wordpress;  
}  
location @sharepoint  
{  
proxy\_pass [http://primaryserver](http://primaryserver);  
proxy\_set\_header Host $host;  
proxy\_connect\_timeout 3;  
proxy\_next\_upstream error timeout;  
}

location @wordpress  
{  
proxy\_pass [http://secondaryserver](http://secondaryserver);  
proxy\_set\_header Host $host;  
proxy\_connect\_timeout 3;  
proxy\_next\_upstream error timeout;  
}

}

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [October 11, 2011, 11:51am UTC](https://www.ruby-forum.com/t/cheap-sharepoint-wordpress-fail-over-help-request/212697/2 "2011-10-11T11:51:05Z")

</div>

On Tue, Oct 11, 2011 at 10:39:43AM +0100, keith wrote:

> {  
> location @wordpress  
> {  
> proxy\_pass [http://secondaryserver](http://secondaryserver);  
> proxy\_set\_header Host $host;  
> proxy\_connect\_timeout 3;  
> proxy\_next\_upstream error timeout;  
> }
> 
> }

“try\_files” tries files, but not proxied requests.  
There are two way to fallback to backup servers:

1. upstream sharepoint {  
server primaryserver;  
server secondaryserver backup;  
}

2. server {  
location / {  
proxy\_pass [http://primaryserver](http://primaryserver);  
proxy\_set\_header Host $host;  
proxy\_connect\_timeout 3;  
proxy\_intercept\_errors on;  
error\_page 502 504 @wordpress;  
}

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [October 11, 2011, 11:51am UTC](https://www.ruby-forum.com/t/cheap-sharepoint-wordpress-fail-over-help-request/212697/3 "2011-10-11T11:51:42Z")

</div>

Try files refers to local files so that wont work. You need a failover  
in  
the upstream.

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [October 11, 2011, 3:26pm UTC](https://www.ruby-forum.com/t/cheap-sharepoint-wordpress-fail-over-help-request/212697/4 "2011-10-11T15:26:14Z")

</div>

On 11/10/2011 10:50, Igor S. wrote:

> > Keith  
> > location /
> 
> There are two way to fallback to backup servers:  
> proxy\_set\_header Host $host;  
> proxy\_intercept\_errors on;

Cheers Igor, Option 2 seems to be working for us !! So thanks for the  
quick answers. I think we just need to setup the correct error codes  
now.

Below is the current configuration that seems to be working.

upstream primaryserver { server 10.0.0.xx:80; }  
upstream secondaryserver { server 10.0.0.xx:80; }

server  
{  
listen 80;  
server\_name [www.somewebsites.com](http://www.somewebsites.com);  
server\_name\_in\_redirect off;

location /  
{  
proxy\_pass [http://primaryserver](http://primaryserver);  
proxy\_set\_header Host $host;  
proxy\_connect\_timeout 3;  
proxy\_intercept\_errors on;  
error\_page 400 403 502 504 @wordpress;  
}

location @wordpress  
{  
proxy\_pass [http://secondaryserver](http://secondaryserver);  
proxy\_set\_header Host $host;  
proxy\_connect\_timeout 3;  
}  
}
