lnmp nginx服务器反向代理配置

首先添加域名
lnmp vhost add
添加域名t2.com
添加成功后,去/usr/local/nginx/conf/vhost  找到t2.com.conf文件,删除里面的内容,新加内容如下:
server
{
listen 80;
server_name t2.com;

location / {
proxy_pass https://www.googls.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

 

nginx -t 检测配饰是否有误

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

 

successful 代表修改配置没有问题

lnmp nginx restart  命令重启nginx服务即可