devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Clarify information on page /guides/v2.4/install-gde/prereq/es-config-apache.html about ports used

Open medmek opened this issue 4 years ago • 2 comments

General issue

Description:

I was confused in regard to port used by elasticsearch (:9200) and the port used by the proxy (:8080)

curl -i -u magento_elasticsearch:mypassword http://localhost:8080/_cluster/health

Possible solutions:

in this example it would be maybe better to specify 9200 as the by default port to use for elasticsearch

Additional information:

In my case when I used 8080 after removing the directives from the unsecure virtual host :

myuser@instance-1:~$ curl -i -u magento_elasticsearch:mypassword https://localhost:8080/_cluster/health
curl: (7) Failed to connect to localhost port 8080: Connection refused

medmek avatar Apr 05 '21 20:04 medmek

Maybe we misleading the information here. Have you setup proxy pass to port 9200 ? This is important part

mrtuvn avatar Apr 11 '21 13:04 mrtuvn

In my /etc/apache2/sites-enabled/000-default.conf I added this :

Listen 8080
<VirtualHost *:80>
...
</VirtualHost>
<VirtualHost *:8080>
    ProxyPass "/" "http://localhost:9200/"
    ProxyPassReverse "/" "http://localhost:9200/"
</VirtualHost>

but I think I removed it following this step :

Step 2: Secure communication with Apache ... 2 - If you added the preceding to your secure virtual host, remove Listen 8080 and the <VirtualHost *:8080> directives you added earlier to your unsecure virtual host.

when I added it back it works 👍

but it's as if my secure conf /etc/apache2/sites-enabled/000-default-le-ssl.conf isn't sufficient :

<IfModule mod_ssl.c>
<VirtualHost *:443>
#    ...
</VirtualHost>
<VirtualHost *:443>
#    ...
</VirtualHost>
<Proxy *>
    Order deny,allow
    Allow from all

    AuthType Basic
    AuthName "Elastic Server"
    AuthBasicProvider file
    AuthUserFile /usr/local/apache/password/.htpasswd_elasticsearch
    Require valid-user

  # This allows OPTIONS-requests without authorization
  <LimitExcept OPTIONS>
        Require valid-user
  </LimitExcept>
</Proxy>
</IfModule>

medmek avatar Apr 17 '21 15:04 medmek