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