nginx配置文件,做多个项目代理

web01:
server {
listen 9988;
server_name www.oldboy.com;
access_log logs/www.oldboy.com_access.log main;
location / {
root html/book/ccpt_5_bbh/html;
index index.html index.htm;
}
}

 

web02:
server {
listen 8899;
server_name www.oldboy.com;
access_log /var/log/nginx/www.oldboy.com_access.log main;
location / {
root /usr/local/nginx/html/book/ccpt_5_bbh/html;
index index.html index.htm;

}
}

 

 


代理nginx:

worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

upstream www_oldboy_com {
server 10.0.0.51:9988 weight=1;
server 10.0.0.52:8899 weight=1;
}
server {
listen 80;
server_name www.oldboy.com;
location / {
index index.html index.htm;
proxy_pass http://www_oldboy_com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
}