Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The setup

Currently, we have an Apache2 webserver acting as load balancer for our web architecture. The backends are Xen virtual machines accessible via IPv6 for the public Internet and via IPv4 for our VPN. The problem is that the Apache 2 loadbalancer doesn't perform as well as we would like it to so we're switching to nginx.

The configuration

The version of nginx installed is 1.3.10 which was compiled with standard Debian options. We had to go for this version because it was the only one that supports IPv6 backends which is a requirement for these VMs. For the moment, nginx only has one "virtual host" or server block and it is the following.

upstream backend-cookissime-prod  {
  server cookissime-prod.cookissime1.vm.cob:80 max_fails=5;
  server cookissime-prod.cookissime2.vm.cob:80 max_fails=5;

server {
#  listen [::]:80;

  access_log  /var/log/nginx/cookissime-prod.log;
  error_log  /var/log/nginx/cookissime-prod.log;

  ## send request back to apache1 ##
  location / {
    proxy_pass  http://backend-cookissime-prod;
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header        Host            $host;
    proxy_set_header        X-Real-IP       $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

upstream backend-cookissime-dev  {
  server cookissime-dev.cookissime1.vm.cob:80 max_fails=5;
  server cookissime-dev.cookissime2.vm.cob:80 max_fails=5;

There is also a second code block which takes the above information and replaces prod with dev. The domain names cookissime-prod.cookissime1.vm.cob and cookissime-prod.cookissime2.vm.cob resolve to an IPv6 on our internal DNS.

The problem

The above configuration seems to be good syntax-wise. The problem is that most of the time, this configuration displays the default "Welcome to nginx" page but sporadically it will display the website for a few minutes then return to the default page.

This very setup works correctly with Apache2 so the virtual machines are functionnal.

What am I missing ? What could cause these problems ?

share|improve this question
Anything in the error log? – mgorven Feb 13 '13 at 18:53
Nope. Error logs empty :/ – Antoine Benkemoun Feb 13 '13 at 18:54
Try setting a different root within that server block (so that you don't get the "Welcome to nginx page") to verify that you're hitting the right server and vhost. – mgorven Feb 13 '13 at 18:59
That doesn't change anything. But I know I hit the right server because the access logs got to the right place. – Antoine Benkemoun Feb 14 '13 at 18:27
Given that your syntax does indeed seem to be correct, I would check that you are indeed always requesting the specified server_name- that is to say, are you always testing to or at some points have you been testing only to which happens to have the same DNS entry as the www subdomain? – BE77Y Dec 3 '14 at 14:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.