当我执行docker-compose up
时,会收到以下消息:
无法访问此站点:本地主机拒绝连接。
尝试:
检查连接
检查代理和防火墙
ERR_CONNECTION_REFUSED
我正在Mac Pro上运行此代码。本地主机曾经工作过,但是随后停止了工作。不知道我做错了什么。
version: '2'
services:
apache:
image: rafaelcgstz/magento2
# build: .
ports:
- "80:80" # web
- "9001:9000" # xdebug
# - "35729:35729" # live reload
volumes:
- cleanMagento-sync:/var/www/html:nocopy
- ~/.composer:/var/www/.composer
- ~/.npm:/var/www/.npm
# - ~/.nvm:/var/www/.nvm
environment:
XDEBUG_CONFIG: "remote_host=10.254.254.254 remote_connect_back=0"
PHP_IDE_CONFIG: "serverName=Docker"
depends_on:
- db
links:
- db
networks:
- cleanMagento-network
networks:
cleanMagento-network:
driver: bridge
volumes:
cleanMagento-sync:
external: true
dbdata:
driver: local
我做了一个docker ps,结果如下
DOCKER PS的结果
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4599fe5ba69b rafaelcgstz/magento2 "docker-php-entrypoi…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:9001->9000/tcp cleanmagento2_apache_1
66acf3523f67 redis "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:32783->6379/tcp cleanmagento2_redis_1
6862029ed184 mariadb "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:3300->3306/tcp cleanmagento2_db_1
ae79672e933e phpmyadmin/phpmyadmin "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:8080->80/tcp cleanmagento2_phpmyadmin_1
666973686e0f mailhog/mailhog "MailHog" About a minute ago Up About a minute 0.0.0.0:1025->1025/tcp, 0.0.0.0:8025->8025/tcp cleanmagento2_mailhog_1
f01b84dad099 redis "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:32782->6379/tcp cleanmagento2_redis-session_1
ee96894956f4 eugenmayer/unison:2.51.2.1 "/entrypoint.sh supe…" About a minute ago Up About a minute 5000/tcp cleanmagento2-sync
我希望本地主机呈现页面。
编辑:
我做了一些测试,现在相信它与apache有关
我做了
ping 127.0.0.1
此返回:
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.042 ms
我还检查了端口上是否还有其他内容:
sudo lsof -i:80 | egrep“ PID | LISTEN”
此返回;
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 860 root 4u IPv6 0xa09c168da64892ef 0t0 TCP *:http (LISTEN)
httpd 864 _www 4u IPv6 0xa09c168da64892ef 0t0 TCP *:http (LISTEN)
然后我测试了我的本地主机;
telnet本地主机80
此返回;
Trying ::1...
Connected to localhost.
最后我做了一个apache配置测试;
apachectl configtest
这返回了以下错误;
AH00557: httpd: apr_sockaddr_info_get() failed for jon-MacBook-Pro.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
不清楚是不是问题的原因,如果是,如何解决