大网数据广告活动
服务器运维问答

Is it possible for CloudFlare to get content from 8080 and serve it on 80?

· 52CE 我爱测

Is it possible for CloudFlare to get content my server provides over port 8080 and serve it on port 80 to users? For instance, I have the following IP address 0.0.0.0 and domain example.ga (registered with CloudFlare). Can CloudF…

问题原文

原帖链接 · Theo · CC BY-SA 3.0

Is it possible for CloudFlare to get content my server provides over port 8080 and serve it on port 80 to users?

For instance, I have the following IP address 0.0.0.0 and domain example.ga (registered with CloudFlare). Can CloudFlare retrieve content from 0.0.0.0:8080 and display it on example.ga:80?

已采纳解答

原帖链接 · Tim · CC BY-SA 3.0

To the best of my knowledge, no. CloudFlare on the free plan can't do port translation. If you make a request on port 80, CloudFlare will send it to your origin on port 80. CloudFlare is essentially invisible. On the enterprise plan CloudFlare may be able to do this for you.

If your server is on port 8080 you should install a reverse proxy. This can be on the same server as the application server, or on a different server. On a different server, with appropriate firewall rules, you can make a DMZ, which increases security.

Nginx is very commonly used as a reverse proxy, either on the same server as your app server or a different server. Nginx can easily accept requests on port 80 then pass them on to an app server running on port 80. It's very lightweight, requiring very little CPU or RAM.

Nginx can also cache pages, based on rules you define, to accelerate serving static resources or anonymous pages. Serving a page from a cache takes much less work than generating the page again. Nginx reverse proxy guide here. I also have an Nginx/Wordpress guide that will give you some more examples on how to cache pages for anonymous users, but not logged in users.

Update based on comments

Apparently on Linux you can use iptables to redirect ports. So for example a server running on port 8080 can respond on port 80. This would have to be set up by a user who as root privileges, as non-privileged users can't listen to ports below 1024.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-04-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。