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

Drew Turner drew at drewnturner.com
Tue Jul 5 19:54:23 UTC 2016


can you move the backend server declaration from your .conf file to the
nginx.conf file inside the http stanza?

On Tue, Jul 5, 2016 at 10:05 AM, NdridCold . <project722 at gmail.com> wrote:

> 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;
>     #}
>
>
>
>
> On Tue, Jul 5, 2016 at 9:47 AM, Drew Turner <drew at drewnturner.com> wrote:
>
>> 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.
>>
>> On Tue, Jul 5, 2016 at 9:41 AM, Brian Pugh <bpugh at cscontract.com> wrote:
>>
>>> 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 at nginx.org> on behalf of Drew Turner <
>>> drew at drewnturner.com>
>>> *Sent:* Tuesday, July 5, 2016 9:33 AM
>>> *To:* nginx at 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 at 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​?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> nginx mailing list
>>>> nginx at nginx.org
>>>> http://mailman.nginx.org/mailman/listinfo/nginx
>>>>
>>>
>>>
>>> _______________________________________________
>>> nginx mailing list
>>> nginx at nginx.org
>>> http://mailman.nginx.org/mailman/listinfo/nginx
>>>
>>
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160705/e1f628ab/attachment.html>


More information about the nginx mailing list