1、安装nginx
nginx安装教程:https://blog.joniding.com/index.php/archives/19
2、新建域名配置文件
#upstream server_name {
# //如果有多台服务器可以在这里配置upstream轮询
# }
server{
server_name your_server_name;
location /{
#允许访问的ip
allow 127.0.0.1;
allow ip地址;
deny all;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#配置账号密码形式登录,这里不需要
#auth_basic "login";
#auth_basic_user_file /etc/nginx/vhost/password/es;
#autoindex on;
proxy_pass http://127.0.0.1:9200;
}
#access_log /data/logs/nginx/es.joniding.com.access.log main;
#error_log /data/logs/nginx/nginx-error.log;
}
#检测
nginx -t
#重启
systemctl restart nginx
3、修改es配置文件
vi config/elasticsearch.yml
将 network.host:0.0.0.0 修改为 127.0.0.1
ps ef | grep elastic 或 netstat -ntlp 找到进程ID kill -9 id
启动 es
网友评论