1.安装nginx:
sudo apt-get install nginx
2.新建配置文件:
cd /etc/nginx/conf.d
sudo vi XXX-cn-8080.conf
内容如下:
upstream aaa{
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 47.94.93.140;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Nginx_Proxy true;
proxy_pass http://aaa;
proxy_redirect off;
}
}
3.测试nginx配置
sudo nginx -t
4:重新加载nginx
sudo nginx -s reload