正如标题所述,我可以正常访问本地主机,但我的应用程序需要通过 127.0.0.1:8000 从 Twitter 获取回调,而 127.0.0.1:8000 显示“连接被拒绝”。
编辑:这似乎是一个 IPv6 冲突,我可以通过(Apache 端口)http://127.0.0.1:8888/ 访问我的本地服务器。
编辑编辑:如果我在端口 9000 上提供一个 Angular 应用程序,我可以使用浏览器中的
因此,我的问题已经明确为:如何使
编辑:这似乎是一个 IPv6 冲突,我可以通过(Apache 端口)http://127.0.0.1:8888/ 访问我的本地服务器。
编辑编辑:如果我在端口 9000 上提供一个 Angular 应用程序,我可以使用浏览器中的
127.0.0.1:9000
正常访问它,但是如果我运行 php artisan serve --port=9000
,我仍然会收到“连接被拒绝”的错误。因此,我的问题已经明确为:如何使
php artisan serve
(用于 Laravel 应用程序)与 http://127.0.0.1:8000/ 兼容?
Lewiss-MBP:stripe2 Lewis$ php artisan serve
Laravel开发服务器已在http://localhost:8000/启动。
重点:
OSX YOSOMITE 10.10.5
MAMP(非专业版)设置为Apache而不是NGINX
etc/hosts: file -b /etc/hosts
=== ASCII英文文本
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Lewiss-MBP:applications Lewis$ telnet -6 ::1 8000 </dev/null
正在尝试连接::1...
已连接到localhost。
转义字符为'^]'。
由外部主机关闭连接。
Lewiss-MBP:applications Lewis$ telnet -4 127.0.0.1 8000 </dev/null
正在尝试连接127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
telnet -6 ::1 8000 </dev/null
和telnet -4 127.0.0.1 8000 </dev/null
命令,看哪个会显示“Connected to ...”,哪个会显示“Connection refused”。 - Gordon Davisson