apache 无法远程连接到magento

iezvtpos  于 2022-11-16  发布在  Apache
关注(0)|答案(1)|浏览(115)

我试图在ec2中部署带有bitnami docker容器的Magento 2服务器,当连接到服务器外部时,它没有给予我响应。
当我在localhost:80中使用curl时,它会给我提供预期的html,但是当我在计算机上使用它时,我只得到以下结果:

curl -v (server.ip):80
*   Trying (server.ip):80...
* Connected to (server.ip) ((server.ip)) port 80 (#0)
> GET / HTTP/1.1
> Host: (server.ip)
> User-Agent: curl/7.85.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Date: Wed, 28 Sep 2022 21:57:22 GMT
< Server: Apache
< Set-Cookie:
PHPSESSID=lbnqf9tmm5pc7fpu7v2dm28lct;expires=Wed, 28-Sep-2022 22:57:22 GMT; Max-Age=3600; path=/; domain=(server.ip); HttpOnly; SameSite=Lax
< Expires: Tue, 28 Sep 2021 21:57:22 GMT
< Cache-Control: max-age=0, must-revalidate, no-cache, no-store
< Pragma: 
< Location: http://localhost/
< Content-Security-Policy-Report-Only: font-src data: 'self' 'unsafe-inline'; form-action <cut this because it tells me it looks like spam>
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< X-UA-Compatible: IE=edge
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host (server.ip) left intact

在这之后应该有html。
我尝试使用端口80的节点中的服务器,它运行正常,安全组也正常,所以我不知道发生了什么。
服务器是一个ubuntu22.04lts与t2.micro和我添加了4gb的交换内存。
我使用docker compose和这个yaml进行安装:

version: '2'
services:
  mariadb:
    image: docker.io/bitnami/mariadb:10.4
    environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=bn_magento
- MARIADB_DATABASE=bitnami_magento
volumes:                                                                                  - '/etc/bitnami/mariadb:/bitnami/mariadb'
  magento:
    image: docker.io/bitnami/magento:2
    ports:
      - '80:8080'
      - '443:8443'
    environment:
      - MAGENTO_HOST=localhost
      - MAGENTO_DATABASE_HOST=mariadb
      - MAGENTO_DATABASE_PORT_NUMBER=3306
      - MAGENTO_DATABASE_NAME=bitnami_magento
      - MAGENTO_DATABASE_USER=bn_magento
      - MAGENTO_SEARCH_ENGINE=elasticsearch6
      - ELASTICSEARCH_HOST=elasticsearch
      - ELASTICSEARCH_PORT_NUMBER=9200
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - ALLOW_EMPTY_PASSWORD=yes
      - MAGENTO_USERNAME=username
      - MAGENTO_PASSWORD=pass
      - MAGENTO_EMAIL=email@gmail.com
      - MAGENTO_FIRST_NAME=firstname
      - MAGENTO_LAST_NAME=lastname
      - MAGENTO_ADMIN_URL_PREFIX=admin
      - MAGENTO_ENABLE_HTTPS=no
      - MAGENTO_ENABLE_ADMIN_HTTPS=no
    volumes:
      - '/etc/bitnami/magento:/bitnami/magento'
    depends_on:
      - mariadb
      - elasticsearch
  elasticsearch:
    image: docker.io/bitnami/elasticsearch:6
    volumes:
      - '/etc/bitnami/elasticsearch:/bitnami/elasticsearch'
    environment:
      - ELASTICSEARCH_HEAP_SIZE=512m
volumes:
  mariadb_data:
    driver: local
  magento_data:
    driver: local
  elasticsearch_data:
    driver: local

这些是magento的日志:sudo docker logs magento

vsaztqbk

vsaztqbk1#

Location: http://localhost/是可疑的。也许你应该把MAGENTO_HOST=localhost参数改为你的aws公共IP(或某个主机名)。试试curl -H 'Host: localhost' http://<server-ip> -v

相关问题