0
我正在關注this教程,在CentOS 7上設置Elasticsearch的nginx infront。我試圖在本教程中運行第一個(非常簡單)的示例。這裏是我的nginx.conf:如何設置Elasticsearch的nginx infront?
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server {
listen 8080;
location/{
proxy_pass http://localhost:9200;
}
}
#include /etc/nginx/conf.d/*.conf;
}
重啓nginx的,運行 curl 'localhost:8080/_nodes/stats/http?pretty'
給出後:
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.13.4</center>
</body>
</html>
雖然localhost:9200
按預期工作。在/var/log/nginx/error.log中寫有四行:
2017/08/17 14:56:48 [crit] 38481#38481: *4 connect() to [::1]:9200 failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /_nodes/stats/http?pretty HTTP/1.1", upstream: "http://[::1]:9200/_nodes/stats/http?pretty", host: "localhost:8080"
2017/08/17 14:56:48 [warn] 38481#38481: *4 upstream server temporarily disabled while connecting to upstream, client: 127.0.0.1, server: , request: "GET /_nodes/stats/http?pretty HTTP/1.1", upstream: "http://[::1]:9200/_nodes/stats/http?pretty", host: "localhost:8080"
2017/08/17 14:56:48 [crit] 38481#38481: *4 connect() to 127.0.0.1:9200 failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /_nodes/stats/http?pretty HTTP/1.1", upstream: "http://127.0.0.1:9200/_nodes/stats/http?pretty", host: "localhost:8080"
2017/08/17 14:56:48 [warn] 38481#38481: *4 upstream server temporarily disabled while connecting to upstream, client: 127.0.0.1, server: , request: "GET /_nodes/stats/http?pretty HTTP/1.1", upstream: "http://127.0.0.1:9200/_nodes/stats/http?pretty", host: "localhost:8080"
爲什麼會有權限被拒絕?我應該設置一些權限嗎?
https://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx – xeye