magento / devdocs

[Deprecated] Magento Developer Documentation
Open Software License 3.0
674 stars 1.76k forks source link

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

Closed medmek closed 2 months ago

medmek commented 3 years ago

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
mrtuvn commented 3 years ago

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

medmek commented 3 years ago

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>
dshevtsov commented 2 months ago

The topic was migrated. If the issue is still relevant, please feel free to reopen it.