安装elasticsearch篇-配置Apache

设置代理

1.启用mod_proxy

sudo a2enmod proxy_http

安装elasticsearch篇-配置Apache_第1张图片
需重启Apache
image.png
2.用文本编辑器打开/etc/apache2/sites-available/000-default.conf
3.在配置文件头部加上:

Listen 8080

4.在配置文件底部加上


    ProxyPass "/" "http://localhost:9200/"
    ProxyPassReverse "/" "http://localhost:9200/"

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}

7.配置magento

7.1 Log in to the Magento Admin as an administrator.
7.2 Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search.
7.3 From the Search Engine list, select your Elasticsearch version.
安装elasticsearch篇-配置Apache_第2张图片
因为我的elasticsearch版本是7.13.3,我选择的是elasticsearch 6.0+
7.4 点击 Test Connection.
成功则显示如下
安装elasticsearch篇-配置Apache_第3张图片

你可能感兴趣的:(安装elasticsearch篇-配置Apache)