Home > Backend Development > PHP Tutorial > php内置的服务器启动后端口不能通过docker转换出来?

php内置的服务器启动后端口不能通过docker转换出来?

WBOY
Release: 2016-06-06 20:19:33
Original
1256 people have browsed it

我做了个镜像,暴露了8000端口,容器内启动了symfony内置的服务器,端口为8000,内部访问没问题的,然后我宿主机端口8001映射到了里面的8000端口,访问说连接不上。按照我的理解,应该是可以的。

回复内容:

我做了个镜像,暴露了8000端口,容器内启动了symfony内置的服务器,端口为8000,内部访问没问题的,然后我宿主机端口8001映射到了里面的8000端口,访问说连接不上。按照我的理解,应该是可以的。

默认是监听 localhost的,你改成监听0.0.0.0

http://symfony.com/doc/current/cookbook/web_server/built_in.html

<code class="bash">$ php bin/console server:start 0.0.0.0:8000</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template