https://mp.csdn.net/postedit/100945051
在这篇文章中 run 的 宿主机的 8080 端口
sudo apt-get update
sudo apt-get install nginx
查看Nginx 版本
sudo nginx -v
打开nginx 配置目录:
cd /etc/nginx/sites-available
sudo vi default
在 default 文件中写入以下内容 进行保存
server {
listen 80;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
}
}
重新加载Nginx
sudo nginx -t
sudo nginx -s reload
扫描二维码关注公众号,回复:
12920133 查看本文章
访问 80 端口 效果如下:
访问 8080 端口 效果如下: