使用反向代理如果访问http://localhost:80(也就是网站的默认端口)让其直接跳转到http://localhost:3000。
需要编辑Nginx的conf文件
vim /etc/nginx/nginx.conf
location / {
# default port, could be changed if you use next with custom server
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# if you have try_files like this, remove it from our block
# otherwise next app will not work properly
# try_files $uri $uri/ =404;
}
然后重启nginx就可以啦
本文指导如何编辑Nginx配置文件,通过反向代理设置,实现从默认端口80访问时自动跳转到3000端口的网站,简单几步即可完成。
1739

被折叠的 条评论
为什么被折叠?



