ubuntu
vi /etc/apt/source.list
加入下面两句话
deb http://nginx.org/packages/ubuntu/ lucid nginx
deb-src http://nginx.org/packages/ubuntu/ lucid nginx
apt-get update
apt-get install nginx
vi /etc/nginx/nginx.conf
负载均衡配置
worker_processes 1;
events {
worker_connections 1024;
}
http{
upstream myproject {
#这里指定多个源服务器,ip:端口,80端口的话可写可不写
server 192.168.43.158:80 weight=2;
server 192.168.41.167 weight=3;
}
server {
listen 8080;
location / {
proxy_pass http://myproject;
}
}
}
worker_rlimit_nofile 44800;
events
{
use epoll;
worker_connections 44800;
}
nginx 的cookie 多台机器是共享cookie的。因为cookie是写在用户客户端的。
session的话,就涉及到多台机器同步session问题了。