0
我調用後臺服務器時,Apache正在使用Javascript運行。我已經安裝了一個nginx代理,並通過它將apache2運行的所有石墨和elasticsearch請求路由到服務器。Nginx Proxy沒有按預期的那樣執行
Nginx確實對服務器進行代理調用但是,它將位置添加到URL的末尾。
例如:http://10.xxx.xxx.23/graphite傳遞給nginx時會調用http://23.xxx.xxx.1:80/graphite。我不希望/石墨到底我想讓ngix簡單地打電話給http://23.xxx.xxx.1:80?
我已經粘貼下面
config.js
datasources: {
graphite: {
type: 'graphite',
url: "http://" + window.location.host + "/graphite",
},
elasticsearch: {
type: 'elasticsearch',
url: "http://" + window.location.host + "/elasticsearch",
index: 'grafana-dash',
grafanaDB: true,
}
}
我nginx.conf文件nginx.conf
worker_processes 1;
daemon off;
error_log <%= ENV["APP_ROOT"] %>/nginx/logs/error.log;
events { worker_connections 1024; }
http {
log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
access_log <%= ENV["APP_ROOT"] %>/nginx/logs/access.log cloudfoundry;
default_type application/octet-stream;
include mime.types;
sendfile on;
gzip on;
tcp_nopush on;
keepalive_timeout 30;
server {
listen <%= ENV["PORT"] %>;
server_name localhost;
location/{
root <%= ENV["APP_ROOT"] %>/public;
index index.html index.htm Default.htm;
<% if File.exists?(File.join(ENV["APP_ROOT"], "nginx/conf/.enable_directory_index")) %>
autoindex on;
<% end %>
<% if File.exists?(auth_file = File.join(ENV["APP_ROOT"], "nginx/conf/.htpasswd")) %>
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file <%= auth_file %>; #For Basic Auth
<% end %>
}
location /graphite {
proxy_pass http://23.xxx.xxx.1:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location /elasticsearch {
proxy_pass http://23.xxx.xxx.1:9080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
}