javascript - Nginx Proxy not executing as expected -


I was calling backend server using apache running JavaScript. I have setup a NGN proxy and all the graphite and elastic search requests through the path were on the server which were running apache2.

Although the proxy calls the Nginx server, it adds the location to the end of the location URL.

For example: When nginx is passed, the call will be done. I do not want graphite / in the end that I need ngix for simple call?

I pasted my nginx.conf file

config.js

  datasources: {graphite: {type: 'graphite', url: "Http: //" + window.location.host + "/ graphite",}, elastic search: {type: 'elasticsearch', url: http: // "+ window.location.host +" / elasticsearch ", index : 'Grafana-dash', grafanaDB: true,}}   

nginx.conf

  worker_processes 1; daemon off; error_log  /nginx/logs/error.log; Events {worker_connections 1024;} Http {log_format cloudfoundry '$ http_x_forwarded_for - $ http_referer - [$ time_local] "$ request" $ position $ body_bytes_sent'; Access_log & Lt;% = ENV ["APP_ROOT"]%> & gt; /nginx/logs/access.log cloudfoundry; Default_type application / octet-stream; Mime.types included ; Send File on; on TCP_nopush; Keepalive_timeout 30; Server {& lt;% = ENV ["PORT"]%> Server_name localhost; location / {root & lt;% = ENV ["APP_ROOT"]% & Gt; / public; index index.html index.htm Default.htm; & Lt;% if file Axis? (File Included (NIV ["APP_ROOT"], "NGN / CONF / .nabal_directory_index"))% & gt; Auto index on; & Lt;% end% & gt; & Lt;% if file Axis? (Auth_file = File.join (ENV ["APP_ROOT"], "nginx / conf / .htpasswd"))%> Auth_basic "restricted"; # Auth_basic_user_file for the parent principal & lt;% = auth_file% & gt ;; # For original at & lt;% end% & gt; } Location / Graphite {proxy_pass http: //23.xxx.xxx.1: 80; Proxy_set_header X-real-IP $ remote_adder; Proxy_set_header X-Forward- $ proxy_add_x_forwarded_for; Proxy_set_header x-forward-proto $ scheme; Proxy_set_header X-Forward-Server $ host; Proxy_set_header X-Forward-Host $ host; Host $ proxy_set_header host; Client_max_body_size 10m; Client_body_buffer_size 128k; Proxy_connect_timeout90; Proxy_send_time90; Proxy_read_timeout 90; Proxy_buffer_size 4k; Proxy_Buffers 4 32K; Proxy_busy_buffers_ size 64k; Proxy_temp_file_write_size 64k; } Location / Elastic Search {Proxy_pass http: //23.xxx.xxx.1: 9080; Proxy_set_header X-real-IP $ remote_adder; Proxy_set_header X-Forward- $ proxy_add_x_forwarded_for; Proxy_set_header x-forward-proto $ scheme; Proxy_set_header X-Forward-Server $ host; Proxy_set_header X-Forward-Host $ host; Host $ proxy_set_header host; Client_max_body_size 10m; Client_body_buffer_size 128k; Proxy_connect_timeout90; Proxy_send_time90; Proxy_read_timeout 90; Proxy_buffer_size 4k; Proxy_Buffers 4 32K; Proxy_busy_buffers_ size 64k; Proxy_temp_file_write_size 64k; }}    

  proxy_pass http: //23.xxx.xxx.1: 80;   

Try it to avoid the spot

  proxy_pass http: //23.xxx.xxx.1: 80 /;    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -