cd /etc/nginx/conf.d/ //转到配置文件目录
vi aaa.com.conf //创建配置文件
server {
listen 80;
server_name aaa.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://指向的IP地址;
}
}
ESC键退出编辑
:wq //保存
nginx -s reload //重启NGINX
nginx -t //检测配置文件是否正常