[英]Telnet connection on localhost Refused
EDIT: 编辑:
I want to telnet
into my web server on localhost
, and request my php
file from command line: 我想
telnet
到localhost
上的Web服务器,并从命令行请求php
文件:
I have: 我有:
1) cd'd into the directory I want to serve, namely " /www
" ( hello.php
is here) 1)cd到我要服务的目录中,即“
/www
”( hello.php
在此处)
2) run a server at directory www: python -m SimpleHTTPServer
2)在目录www上运行服务器:
python -m SimpleHTTPServer
3) telnet localhost 80
3)
telnet localhost 80
but "connection is refused". 但是“连接被拒绝”。 what am I doing wrong?
我究竟做错了什么?
You're probably trying to connect to a wrong port. 您可能正在尝试连接到错误的端口。 Check with
netstat -lntp
which port is your http server listening on. 使用
netstat -lntp
检查哪个HTTP服务器正在监听。 The process will be listed as python/pid_number
. 该过程将列为
python/pid_number
。
If you're using Linux then try this: 如果您使用的是Linux,请尝试以下操作:
$ telnet localhost 80
GET /hello.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.