nginx not forwarding requests to backend servers.

Brian Pugh project722 at gmail.com
Wed Jul 27 13:42:58 UTC 2016


I am posting this again because a copy never appeared in my inbox. Please
ignore if it was actually delivered to the group already.

I am using nginx as a load balancer. However when I type in the URL for my
site, which resolves to the IP of the load balancer, I get the default
nginx page saying "nginx has been setup more configuration is required". I
would expect nginx to forward my request through to the backend servers I
have defined. And oddly enough, there is very little in the way of logging
going on, to tell me why its failing.

*My nginx.conf file is as follows:*

user  nginx;
worker_processes  4;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    upstream myappliationsite.net {
        # Use ip hash for session persistance
        ip_hash;
        server backendappsite1.net;
        server backendappsite2.net;
        server backendappsite3.net;

        # The below only works on nginx plus
        #sticky route $route_cookie $route_uri;
}
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request"
'
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  60;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

*My default.conf file is as follows:*

server {

    listen       80;
    server_name myappliationsite.net;
    keepalive_timeout 70;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
<http://127.0.0.1/>
    #
    location ~ \.php$ {
        proxy_pass   http://myappliationsite.net;
        proxy_set_header HOST myappliationsite.net;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    }

 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

server {

    listen       443 ssl;
    server_name myappliationsite.net;
    keepalive_timeout 70;

    ssl_certificate     /certs/fd.crt;
    ssl_certificate_key /keys/lb.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
<http://127.0.0.1/>
    #
    location ~ \.php$ {
       proxy_pass   https://myappliationsite.net;
       proxy_set_header HOST myappliationsite.net;
       proxy_http_version 1.1;
       proxy_set_header Connection "";
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}

    Can anyone help my get requests to go to the backend servers? Is there
any other config or depenency apps needed that I may not have installed or
running? Also is there a way to enable more advanced debug logging to give
me a better idea whats going on?

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160727/9fee698b/attachment.html>


More information about the nginx mailing list