<div dir="ltr">Hi All,<div><br></div><div>I have now tried to use FQDN but still same issue.</div><div><br></div><div><span class="gmail-im" style="color:rgb(80,0,80)"><div>server 1</div><div>server_name <a href="http://abc.com/" target="_blank">abc.com</a>;</div><div>    access_log  /var/log/nginx/abc.access.log;<br>    error_log   /var/log/nginx/abc.error.log warn;<br>location /abc {<br>          proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host $http_host;<br>        proxy_pass_header X_CUSTOM_HEADER;<br>          proxy_pass <a href="https://def.com/abc">https://def.com/abc</a>;<br>}</div><div><br></div><div>Backend Server</div><div><br></div><div>server_name <a href="http://def.com/" target="_blank">def.com</a>;<br></div><div>    access_log  /var/log/nginx/def.access.log;<br>    error_log   /var/log/nginx/def.error.log warn;  <br></div></span><div><span class="gmail-im" style="color:rgb(80,0,80)">    location /abc {<br>                proxy_set_header X-Real-IP       $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host            $host;<br></span>        proxy_pass <a href="http://localhost:1111/" target="_blank">http://localhost:1111</a>;<br><br>    }<br></div><span class="gmail-im" style="color:rgb(80,0,80)"><div><br></div><div>server_name <a href="http://ghi.co.com/" target="_blank">ghi.co.com</a>;</div><div>    access_log  /var/log/nginx/ghi.access.log;<br>    error_log   /var/log/nginx/ghi.error.log warn;  <br></div></span><div><span class="gmail-im" style="color:rgb(80,0,80)">    location /xyz {<br>                proxy_set_header X-Real-IP       $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host            $host;<br></span>        proxy_pass <a href="http://localhost:2222/" target="_blank">http://localhost:2222</a>;<br><br>    }  </div></div><div><br></div><div>Still the <span style="color:rgb(80,0,80)"> /var/log/nginx/ghi.access.</span><span style="color:rgb(80,0,80)">log loaded with the requests which comes to <a href="http://def.com">def.com</a>. Can you help me fix this issue.</span></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks & Regards<br>Sathish Kumar.V</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 24, 2019 at 8:07 AM Sathish Kumar <<a href="mailto:satcse88@gmail.com">satcse88@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail-m_-3246019412944356323gmail-gs" style="margin:0px;padding:0px 0px 20px;width:872px;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div class="gmail-m_-3246019412944356323gmail-"><div id="gmail-m_-3246019412944356323gmail-:1ah" class="gmail-m_-3246019412944356323gmail-ii gmail-m_-3246019412944356323gmail-gt gmail-m_-3246019412944356323gmail-adO" style="font-size:12.8px;direction:ltr;margin:8px 0px 0px;padding:0px"><div id="gmail-m_-3246019412944356323gmail-:1ai" class="gmail-m_-3246019412944356323gmail-a3s gmail-m_-3246019412944356323gmail-aXjCH" style="overflow:hidden;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif"><div dir="ltr"><div>Hi Team, <br></div><div><br></div><div>Please ignore my previous email. Kindly check the below config and suggest me a solution.<br></div><div><br></div><div>server 1</div><div>server_name <a href="http://abc.com/" target="_blank">abc.com</a>;</div><div>    access_log  /var/log/nginx/abc.access.log;<br>    error_log   /var/log/nginx/abc.error.log warn;<br>location /abc {<br>          proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host $http_host;<br>        proxy_pass_header X_CUSTOM_HEADER;<br>          proxy_pass <a href="https://1.1.1.1/abc" target="_blank">https://1.1.1.1/abc</a>;<br><br>}</div><div><br></div><div>Backend Server</div><div><br></div><div>server_name <a href="http://def.com/" target="_blank">def.com</a>;<br></div><div>    access_log  /var/log/nginx/def.access.log;<br>    error_log   /var/log/nginx/def.error.log warn;  <br></div><div>    location /abc {<br>                proxy_set_header X-Real-IP       $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host            $host;<br>        proxy_pass <a href="http://localhost:1111" target="_blank">http://localhost:1111</a>;<br><br>    }<br></div><div><br></div><div>server_name <a href="http://ghi.co.com/" target="_blank">ghi.co.com</a>;</div><div>    access_log  /var/log/nginx/ghi.access.log;<br>    error_log   /var/log/nginx/ghi.error.log warn;  <br></div><div>    location /xyz {<br>                proxy_set_header X-Real-IP       $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host            $host;<br>        proxy_pass <a href="http://localhost:2222" target="_blank">http://localhost:2222</a>;<br><br>    }  <br></div><div><br></div><div><br></div><div>If I enable this Nginx Config, the virtual hosts on the Backend server like <a href="http://ghi.co.com/" target="_blank">ghi.co.com</a>  are logging with the requests coming to <a href="http://def.com/" target="_blank">def.com</a></div><div><br></div><div>Can you let me know,what I am missing and why I am facing incorrect logging requests to the file   /var/log/nginx/ghi.access.log.</div><div><br><div><div dir="ltr" class="gmail-m_-3246019412944356323gmail-m_6941275183986914673gmail_signature"><div dir="ltr">Thanks & Regards<br></div></div></div></div></div></div></div></div></div><div><div dir="ltr" class="gmail-m_-3246019412944356323gmail_signature"><div dir="ltr"><div>Sathish Kumar.V</div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 24, 2019 at 8:04 AM Sathish Kumar <<a href="mailto:satcse88@gmail.com" target="_blank">satcse88@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Team,<div><br></div><div>I am already setting below headers.</div><div>server 1</div><div>server_name <a href="http://abc.com" target="_blank">abc.com</a>;</div><div>    access_log  /var/log/nginx/abc.access.log;<br>    error_log   /var/log/nginx/abc.error.log warn;<br>location /abc {<br>          proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host $http_host;<br>        proxy_pass_header X_CUSTOM_HEADER;<br>          proxy_pass <a href="https://1.1.1.1/abc" target="_blank">https://1.1.1.1/abc</a>;<br><br>}</div><div><br></div><div>Backend Server</div><div><br></div><div>server_name <a href="http://def.com" target="_blank">def.com</a>;<br></div><div>    access_log  /var/log/nginx/def.access.log;<br>    error_log   /var/log/nginx/def.error.log warn;  <br></div><div>    location /abc {<br>                proxy_set_header X-Real-IP       $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host            $host;<br>        proxy_pass <a href="http://1.1.1.1/abc" target="_blank">http://1.1.1.1/abc</a>;<br><br>    }<br></div><div><br></div><div>server_name <a href="http://ghi.co.com" target="_blank">ghi.co.com</a>;</div><div>    access_log  /var/log/nginx/ghi.access.log;<br>    error_log   /var/log/nginx/ghi.error.log warn;  <br></div><div>    location /xyz {<br>                proxy_set_header X-Real-IP       $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header Host            $host;<br>        proxy_pass <a href="http://1.1.1.1/xyz" target="_blank">http://1.1.1.1/xyz</a>;<br><br>    }  <br></div><div><br></div><div><br></div><div>If I enable this Nginx Config, the virtual hosts on the Backend server like <a href="http://ghi.co.com" target="_blank">ghi.co.com</a>  are logging with the requests coming to <a href="http://def.com" target="_blank">def.com</a></div><div><br></div><div>Can you let me know,what I am missing and why I am facing incorrect logging requests to the file   /var/log/nginx/ghi.access.log.</div><div><br><div><div><div dir="ltr" class="gmail-m_-3246019412944356323gmail-m_6941275183986914673gmail_signature"><div dir="ltr"><div>Thanks & Regards<br>Sathish Kumar.V</div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 24, 2019 at 7:35 AM Sathish Kumar <<a href="mailto:satcse88@gmail.com" target="_blank">satcse88@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Hi Rozitis,</div><div dir="auto"><br></div><div dir="auto">Thanks for your reply.<br><div dir="auto"><br></div><div dir="auto"><br></div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Thu, May 23, 2019, 10:58 PM Reinis Rozitis <<a href="mailto:r@roze.lv" target="_blank">r@roze.lv</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Instead of IP address, if we use FQDN with https, do we have to validate the SSL certificate on Proxy_Pass?. <br>
<br>
By default the certificate validation is turned off (and nginx just uses the ssl for traffic encryption). <br>
If needed you can enable it with proxy_ssl_verify on; ( <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_verify" rel="noreferrer noreferrer" target="_blank">http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_verify</a> )<br>
<br>
<br>
> Due to IP address, multiple sites on the server Nginx access log logging the same requests.<br>
<br>
If you do the logging on the backend server (and there are multiple virtualhosts) and proxy_pass is via <a href="http://ip" rel="noreferrer noreferrer" target="_blank">http://ip</a>, then you need/have to pass also the Host header.<br>
<br>
Either by passing the Host header from original request:<br>
<br>
proxy_set_header Host $host;<br>
<br>
or you can specify a custom one:<br>
<br>
proxy_set_header Host "some.domain";<br>
<br>
<br>
<br>
> Is the above Nginx config, correct way of doing it?.<br>
<br>
Depends on your setup and what you want to achieve.<br>
<br>
<br>
For example if your location blocks match the request on the backend you can omit the URI in the proxy_pass directive:<br>
<br>
location /abc {<br>
proxy_pass <a href="https://1.1.1.1" rel="noreferrer noreferrer" target="_blank">https://1.1.1.1</a>;<br>
}<br>
<br>
rr<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" rel="noreferrer" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>