内容简介:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kongxx/article/details/84891364
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kongxx/article/details/84891364
首先需要在系统上安装nginx软件,这里使用Ubuntu的apt来安装。
sudo apt-get install nginx
安装完成后,我们首先需要修改一个ngins的配置。
这里假定我们已经有了个两个相同的web应用,分别使用的 8081 和 8082 端口。我们通过nginx的8080端口代理这两个web应用。
修改 /etc/nginx/nginx.conf 文件,在其中的 http 部分最后做如下配置:
...
http {
...
########################################
# 注释部分
# include /etc/nginx/sites-enabled/*;
########################################
########################################
# 增加部分
upstream myhost {
server localhost:8081 weight=1;
server localhost:8082 weight=1;
}
server {
listen 8080;
location / {
proxy_pass http://myhost;
}
}
########################################
}
启动 nginx 服务
sudo /etc/init.d/nginx start
然后通过浏览器访问 http://:8080 地址来验证配置是否生效。
以上所述就是小编给大家介绍的《使用nginx负载均衡web应用》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Database Design and Implementation
Edward Sciore / Wiley / 2008-10-24 / 1261.00 元
* Covering the traditional database system concepts from a systems perspective, this book addresses the functionality that database systems provide as well as what algorithms and design decisions will......一起来看看 《Database Design and Implementation》 这本书的介绍吧!