最快的方法用Nginx设置端口转发:
以Ubuntu为例:
1.安装:
sudo apt-get install nginx
2./etc/nginx下.找到nginx.conf,赋予权限:
sudo chmod 777 nginx.conf
3.注释掉:#include /etc/nginx/sites-enabled/*; //
4.添加在http{}里
server {
listen 80; #设置默认端口80
server_name localhost;
location / {
proxy_pass http://127.0.0.1:5000; #80端口指向5000端口,本地浏览器打开127.0.0.1:80即可访问:5000
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
5.重启
sudo service nginx restart