Forum: NGINX does nginx forward requests to backend servers using http or https?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7b7f9843950ac972d51e43d963b7c704?d=identicon&s=25 Brian Pugh (Guest)
on 2016-07-05 16:27
(Received via mailing list)
I am using the free version of nginx on RHEL 6.7. The version is :


nginx-1.10.1-1.el6.ngx.x86_64


When using nginx as a load balancer I would like to know if nginx
forwards requests to backend servers using http or https??
B61ff98fdaa969f60be8cfd328a3a7a2?d=identicon&s=25 Drew Turner (Guest)
on 2016-07-05 16:34
(Received via mailing list)
You define what you want it sent to the backend as.  So if you use
http://backendserver it's http, if https://backendserver:443 - https.
7b7f9843950ac972d51e43d963b7c704?d=identicon&s=25 Brian Pugh (Guest)
on 2016-07-05 16:42
(Received via mailing list)
Are you referring to the proxy pass declaration? If so I get an error
when I uncomment that line out saying "nginx: [emerg] "proxy_pass"
directive is not allowed here in /etc/nginx/conf.d/default.conf:40?"




________________________________
From: nginx <nginx-bounces@nginx.org> on behalf of Drew Turner
<drew@drewnturner.com>
Sent: Tuesday, July 5, 2016 9:33 AM
To: nginx@nginx.org
Subject: Re: does nginx forward requests to backend servers using http
or https?

You define what you want it sent to the backend as.  So if you use
http://backendserver it's http, if https://backendserver:443 - https.

On Tue, Jul 5, 2016 at 9:26 AM, Brian Pugh
<bpugh@cscontract.com<mailto:bpugh@cscontract.com>> wrote:

I am using the free version of nginx on RHEL 6.7. The version is :


nginx-1.10.1-1.el6.ngx.x86_64


When using nginx as a load balancer I would like to know if nginx
forwards requests to backend servers using http or https??
B61ff98fdaa969f60be8cfd328a3a7a2?d=identicon&s=25 Drew Turner (Guest)
on 2016-07-05 16:47
(Received via mailing list)
Yes that is in proxy_pass.  Are you sure proxy_pass is defined in the
server stanza and that it's inside an include stanza?

Posting the code would be helpful if you can redact the sensitive
information.
Ddd8d9215c7111b7bc7c2c4eb125fad5?d=identicon&s=25 NdridCold . (Guest)
on 2016-07-05 17:05
(Received via mailing list)
Yes, However I did not have the entire stanza un-commented out. I have
done
that, but now I am encountered with a different error message. Now I
get:

nginx: [emerg] host not found in upstream "resolveservergroup.com" in
/etc/nginx/conf.d/default.conf:40

Here is my default.conf file:

upstream backendservergroup.com {
        # Use ip hash for session persistance
        ip_hash;
        # backend server 1
        server 192.168.155.120;
        # backend server 2
        server 192.168.155.126;
        # backend server 3
        server 192.168.155.127;

        # The below only works on nginx plus
        #sticky route $route_cookie $route_uri;
}
server {

    listen       80;
    server_name  nginxserver.com;
    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
    #
    location ~ \.php$ {
        proxy_pass   http://backendservergroup.com;
        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  nginxserver.com;
    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
    #
    location ~ \.php$ {
       proxy_pass   https://backendservergroup.com:443;
       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;
    #}
B61ff98fdaa969f60be8cfd328a3a7a2?d=identicon&s=25 Drew Turner (Guest)
on 2016-07-05 21:55
(Received via mailing list)
can you move the backend server declaration from your .conf file to the
nginx.conf file inside the http stanza?
This topic is locked and can not be replied to.