2024年3月20日发(作者:)

nginx-1.0.15负载均衡安装配置

OS:ubuntu

1、取得软件

apt-get install gcc libpcre* zlib

2、安装rewrite的支持库pcre

unzip

cd pcre-8.30

./configure

make

make install

3、配置

cat /usr/local/nginx/conf/ | grep -Ev '(#|^$)'

worker_processes 1;

events {

worker_connections 1024;

}

http {

include ;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

upstream {

server 10.0.0.252:8080;

server 10.0.0.253:8080;

server 10.0.0.105:8080;

}

server {

listen 80;

server_name ;

location ~ ^/$ {

rewrite ^/(.*) /jboss/ break;

proxy_pass ;

}

}

}

4、启动nginx服务

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/