Nginx 配置

#user nobody;
worker_processes 4;

error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 10024;
}

http {
#include /usr/local/nginx/conf/proxy.conf;
#include /usr/local/nginx/conf/vhosts/www.test.com.conf;

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;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;
client_max_body_size 1000M;
client_body_buffer_size 128K;
server_tokens off;

fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;#8 128
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

#add_header Set-Cookie “HttpOnly”;
#add_header Set-Cookie “Secure”;
#add_header X-Frame-Options “SAMEORIGIN”;

location / {
root html;
index index.html index.htm index.jsp;
proxy_pass http://oa.xxx.com;
proxy_read_timeout 300; #3600#second
proxy_send_timeout 300; #3600
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
proxy_redirect http:// $scheme://;
#proxy_temp_file_write_size 128k;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}

upstream oa.xxx.com {
sticky;
#ip_hash;
server 192.168.8.161:8080;#app1
server 192.168.8.162:8080;#app2

#server 192.168.1.100:8001 down;
#server 192.168.1.100:8002 max_fails=3;
#server 192.168.1.100:8003 fail_timeout=20s;
#server 192.168.1.100:8004 max_fails=3 fail_timeout=20s;
#jvm_route $cookie_JSESSIONID|sessionid;
}

server {
listen 9081;
server_name secondProxyServer;
location / {
proxy_pass http://192.168.8.161:9081;
}
}

server {
listen 9082;
server_name secondProxyServer;
location / {
proxy_pass http://192.168.8.162:9081;
}
}

server {
listen 443 ssl;
server_name oa.xxx.com;

ssl on;
ssl_certificate /usr/local/nginx/keys/1_oa.xxx.com_bundle.crt;
ssl_certificate_key /usr/local/nginx/keys/2_oa.xxx.com.key;

ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers TLSv1:+HIGH:-MEDIUM:-LOW:-EXPORT:-aNULL:-eNULL:@STRENGTH;
ssl_prefer_server_ciphers on;

location / {
proxy_pass http://oa.xxx.com;
}
}

}

Leave a Comment