1. 安装Nginx
yum -y install nginx
2. 修改配置文件,默认目录/etc/nginx.conf,以下是精简配置
worker_processes 1;
events {
worker_connections 1024;
}http {
include mime.types;
default_type application/octet-stream;#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;keepalive_timeout 65;
gzip on;server {
listen 80;
server_name abcd.com;
location / {
proxy_pass http://10.1.1.1:1111/;
}
}
}
3. 负载均衡
upstream summer {
server 10.1.1.1;
server 10.1.1.2;
}server {
listen 80;
server_name abcd;
location / {
proxy_pass http://summer;
}
}