Linux下如何把外网的web服务和DNS请求映射到内网web服务器的响应端口
server {
listen 80;
server_name example.com *.example.com; #没域名删掉可以
location / {
proxy_pass http://localhost:1818;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
这个和Linux没关系吧,应该在在路由器上做端口映射吧。如果只是做转发可以用Nginx