nginx 配置文件

 

#基于ip设置

server{
listen 80;
server_name 192.168.116.129;
location /{
    root /usr/etc/ngin/html/ip;
    index index.html;
  }

}

#基于域名

server{
  listen 80;
  server_name z.com;
  location /{
    root z.com;
    index index.html;
  }

}

#基于端口号

server{
  listen 2022;
  server_name z.com;
  location /{
    root /var/www/html;
    index index.html;
  }

}

 

# -s reload 重新读取配置文件

# -t 编译配置文件是否正确

负载均衡配置

 

 

代理到一台服务器:

location / {
               proxy_pass      http://192.168.18.201;
       }
 
连接状态 

location /status {
  stub_status on;
  access_log off;
  allow 192.168.170.151;
  deny all;
}

 安装压力测试 ab  # yum install httpd-tools

配置文件详解:http://blog.csdn.net/tjcyjd/article/details/50695922

posted @ 2016-10-29 21:03  steven.木子  阅读(154)  评论(0编辑  收藏  举报