安装nginx后无法连接到localhost:80

neu*_*ert 5 networking linux http iptables nginx

我刚刚安装了 nginx,但sudo yum install nginx无法在端口 80 上连接到它。

我尝试通过这样做来停止 iptables,sudo service iptables start但仍然无法连接。

我正在通过执行telnet localhost 80. 这是我要返回的输出:

Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Run Code Online (Sandbox Code Playgroud)

当我尝试telnet localhost 22它时,它会像我期望的那样工作:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Ric*_*lka 5

你真的在运行吗?

我会做:

netstat -lnt | grep 80
Run Code Online (Sandbox Code Playgroud)

看看是否真的有什么东西在运行。如果你是 root,你可以这样做:

netstat -lntp | grep 80
Run Code Online (Sandbox Code Playgroud)

它还会向您显示 PID。

如果您只是将其关闭,我不能保证它无论如何都配置为在端口 80 上运行。它可以配置为另一个端口,用于测试。