我有一个PHP docker容器,这是我的symfony项目.
这是我的docker-compose.yml
PHP-fpm: build: ./PHP container_name: PHP-fpm links: - db ports: - 9000:9000 - 8448:8448 - 8000:8000 working_dir: /var/www/html/ volumes: - ../app:/var/www/html volumes_from: - data tty: true env_file: - ./docker.env entrypoint: /entrypoint.sh
我想用这个命令启动我的symfony项目:
PHP bin/console server:run localhost:8000
但是当我想访问网址时,它无法正常工作.我有这个错误消息:
The localhost page isn’t working
localhost didn’t send any data.
我该如何解决这个问题?
PS:我正在使用docker for mac
和PHP bin / console -vvv服务器:运行localhost:8000输出:
[2016-08-06 14:09:53] PHP.DEBUG: fsockopen(): unable to connect to
localhost:8000 (Connection refused)
{“type”:2,”file”:”/var/www/html/symfony-test/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.PHP”,”line”:59,”level”:28928}06002
// Quit the server with CONTROL-C.
RUN ‘/usr/local/bin/PHP’ ‘-S’ ‘localhost:8000’
‘/var/www/html/symfony-test/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.PHP’
关注@Alex Blex回答:它在所有接口上运行时都有效.
原文链接:https://www.f2er.com/php/130571.htmlPHP bin/console server:run 0.0.0.0:8000