Tinyhttpd icon indicating copy to clipboard operation
Tinyhttpd copied to clipboard

在虚拟机运行httpd,然后在windows浏览器中访问

Open gitcpplinue opened this issue 3 years ago • 1 comments

自己在运行项目时遇到了一些问题,现在已经解决。

问题 成功运行httpd后,可以通过命令curl -v localhost:4000/index.htmlcurl -v localhost:4000/color.cgi从服务端获得回应,但无法通过windows浏览器访问服务端。 解决 1、设置防火墙开放相应端口firewall-cmd --add-port=4000/tcp。这里修改了代码,将端口固定为4000而不是让系统随机分配。 2、使用whereis perl命令获得perl程序的地址,然后vim htdocs/color.cgi,将第一行的perl地址改为自己查到的路径。

在windows浏览器中输入(自己的虚拟机ip):4000,可成功访问index.html界面,输入颜色可获得color.cgi的运行结果。

gitcpplinue avatar Sep 10 '21 15:09 gitcpplinue

你好,你是怎么跑起来的? 我这里执行 make 后编译失败。

zhouxin1630 avatar Dec 22 '21 13:12 zhouxin1630