设置代理
1. 启用 mod_proxy
sudo a2enmod proxy_http
需重启 Apache
2. 用文本编辑器关上 /etc/apache2/sites-available/000-default.conf
3. 在配置文件头部加上:
Listen 8080
4. 在配置文件底部加上
<VirtualHost *:8080>
ProxyPass "/" "http://localhost:9200/"
ProxyPassReverse "/" "http://localhost:9200/"
</VirtualHost>
5. 需重启 Apache
sudo systemctl restart apache2
6. 验证代理是否胜利
curl -i http://localhost:8080/_cluster/health
如果显示信息跟以下相似阐明胜利
HTTP/1.1 200 OK
Date: Tue, 23 Feb 2016 20:38:03 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 389
Connection: keep-alive
{"cluster_name":"elasticsearch","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":50.0}