ITeye博客

nginx负载均衡简单配置

henghengdh · 2012-12-27 14:38 · linux · 操作系统 · nginx · Markdown

在http中配置

upstream test{
                ip_hash;//采用ip_hash方式解决session问题
                server 127.0.0.1:8082;
                server 127.0.0.1:8081;
        }

并引入

include /etc/nginx/vhosts_conf/*.conf;

在vhosts_conf下的conf文件中

server {
                listen 808;
                server_name www.test.com;
                index index.jsp index.html index.htm;
                root /home/www/test.com;
                location / {
                        proxy_pass http://test;
                }
        }

nginx命令: 启动: ./nginx 重启: ./nginx -s reload 步骤1:查询nginx主进程号 ps -ef | grep nginx 在进程列表里 面找master进程,它的编号就是主进程号了。 步骤2:发送信号 从容停止Nginx: kill -QUIT 主进程号 快速停止Nginx: kill -TERM 主进程号 强制停止Nginx: pkill -9 nginx

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。