美文网首页
Nginx使用

Nginx使用

作者: 惜小八 | 来源:发表于2020-06-12 00:16 被阅读0次

一.nginx反向代理

1.在本地hosts文件当中修改要访问的nginx所在的主机ip和域名相对应
2.修改nginx的配置文件,设置监听和proxy_pass,重启nginx
hosts文件当中添加主机和域名
配置server_name为本机,proxy_pass为本机

二.nginx负载均衡

负载均衡nginx配置

三.动静分离

nginx动静分离设置

四.总结

#反向代理小结:
location /a{
    proxy_pass  http://ip;
}

location /b/{
    proxy_pass  http://ip/;
}



####在浏览器当中输入以下会导致
/a/x   --->   http://ip/a/x;
/b/x/  --->   http://ip/x;




相关文章

网友评论

      本文标题:Nginx使用

      本文链接:https://www.haomeiwen.com/subject/izqtictx.html