user nobody nobody;
worker_processes 3;
pid logs/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1024;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#gunzip_static on;
upstream backend
{
server 192.168.1.30:8081;
server 192.168.1.31:8081;
server 192.168.1.32:8081;
}
server {
listen 8081;
server_name 192.168.1.30;
error_page 404 /404.html;
location / {
root myweb;
index index.30.htm;
}
location /server0/location1 {
root myweb;
index index.svr0-loc1.htm;
}
location /svr0/loc2 {
alias myweb/server0/location2/;
index index.svr0-loc2.htm;
}
}
server {
listen 8081;
server_name 192.168.1.31;
error_page 404 /404.html;
location / {
root myweb;
index index.31.htm;
}
location /server1/location1 {
root myweb;
index index.svr1-loc1.htm;
}
location /svr1/loc2 {
alias myweb/server1/location2/;
index index.svr1-loc2.htm;
}
}
server {
listen 8081;
server_name 192.168.1.32;
error_page 404 /404.html;
location / {
root myweb;
index index.32.htm;
}
location /server2/location1 {
root myweb;
index index.svr2-loc1.htm;
}
location /svr2/loc2 {
alias myweb/server2/location2/;
index index.svr2-loc2.htm;
}
}
server {
listen 8081;
server_name myserver;
#index index.html index.htm;
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
}
}
}