nginx 在 fireswalld 下无法访问, 希望大佬指点

2018-10-11 10:07:56 +08:00
 fov6363

背景

现象

➜  ~ curl -v http://39.107.204.247:80
* Rebuilt URL to: http://39.107.204.247:80/
*   Trying 39.107.204.247...
* TCP_NODELAY set
* Connected to 39.107.204.247 (39.107.204.247) port 80 (#0)
> GET / HTTP/1.1
> Host: 39.107.204.247
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 302
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 08:00:00 CST
< Location: https://39.107.204.247/
< Content-Length: 0
< Date: Thu, 11 Oct 2018 01:54:33 GMT
<
* Connection #0 to host 39.107.204.247 left intact
➜  ~

[root@iZ2ze36uo36nxexxnfulpxZ ~]# curl -v http://39.107.204.247:80
* About to connect() to 39.107.204.247 port 80 (#0)
*   Trying 39.107.204.247...
* Connected to 39.107.204.247 (39.107.204.247) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 39.107.204.247
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.12.2
< Date: Thu, 11 Oct 2018 01:55:06 GMT
< Content-Type: text/html
< Content-Length: 3700
< Last-Modified: Tue, 06 Mar 2018 09:26:21 GMT
< Connection: keep-alive
< ETag: "5a9e5ebd-e74"
< Accept-Ranges: bytes
<
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
....省略 html 内容

firewalld 配置

[root@iZ2ze36uo36nxexxnfulpxZ ~]#  firewall-cmd --list-all
public
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: ssh dhcpv6-client http https mysql
  ports: 80/tcp 443/tcp 3306/tcp 3611/tcp 9000/tcp
  protocols:
  masquerade: no
  forward-ports: port=80:proto=tcp:toport=8080:toaddr=
	port=443:proto=tcp:toport=8443:toaddr=
  source-ports:
  icmp-blocks:
  rich rules:

nginx

[root@iZ2ze36uo36nxexxnfulpxZ ~]# ps -ef|grep nginx
root     20510     1  0 10 月 10 ?      00:00:00 nginx: master process /usr/sbin/nginx
nginx    20511 20510  0 10 月 10 ?      00:00:00 nginx: worker process
nginx    20512 20510  0 10 月 10 ?      00:00:00 nginx: worker process
root     23573 23536  0 10:00 pts/0    00:00:00 grep --color=auto nginx
1843 次点击
所在节点    Linux
2 条回复
e9e499d78f
2018-10-11 10:09:52 +08:00
里面有个 forward 80 到 8080 的规则
fov6363
2018-10-11 10:15:12 +08:00
@e9e499d78f 感谢,这么一说我忽然明白了....我没看懂那个 forward-ports 是什么意思, 你这样一说,我忽略明白了...那个 java 程序是 8080 端口的..我尝试改一波

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/496589

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX