nginx.conf 2.9 KB
Newer Older
U
Ulric Qin 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
user root;

worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 204800;

error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    use epoll;
    worker_connections 204800;
}

http {
    log_format  main  '$server_addr $host $remote_addr [$time_local] $scheme "$request" '
                      '$status $upstream_status $body_bytes_sent $request_time $upstream_addr $upstream_response_time "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;


    proxy_connect_timeout   500ms;
    proxy_send_timeout      1000ms;
    proxy_read_timeout      3000ms;
    proxy_buffers           64 8k;
    proxy_busy_buffers_size    128k;
    proxy_temp_file_write_size 64k;
    proxy_redirect off;
    proxy_next_upstream error invalid_header timeout http_502 http_504;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Real-Port $remote_port;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    client_max_body_size 100m;
    client_body_buffer_size 512k;
    client_body_timeout 180;
    client_header_timeout 10;
    send_timeout 240;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_comp_level 2;
    gzip_types application/javascript application/x-javascript text/css text/javascript image/jpeg image/gif image/png;
    gzip_vary off;
    gzip_disable "MSIE [1-6]\.";

64
    upstream n9e.server {
Q
qinyening 已提交
65
        server 127.0.0.1:8000;
U
Ulric Qin 已提交
66 67 68 69
        keepalive 60;
    }

    upstream n9e.index {
70
        server 127.0.0.1:8012;
U
Ulric Qin 已提交
71 72 73 74 75
        keepalive 60;
    }

    server {
        listen       80 default_server;
Q
qinyening 已提交
76
        server_name  localhost;
U
Ulric Qin 已提交
77
        root         /home/n9e/pub;
U
Ulric Qin 已提交
78 79 80 81 82 83 84 85

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location =/ {
            rewrite / /mon;
        }

U
UlricQin 已提交
86 87
        location / {
            try_files $uri /layout/index.html;
U
Ulric Qin 已提交
88 89
        }

U
Ulric Qin 已提交
90
        location ~ .*(.htm|.html|.json)$ {
U
UlricQin 已提交
91
            add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
U
Ulric Qin 已提交
92 93 94
        }

        location /api/rdb {
95
            proxy_pass http://n9e.server;
U
Ulric Qin 已提交
96 97 98
        }

        location /api/ams {
99
            proxy_pass http://n9e.server;
U
Ulric Qin 已提交
100 101 102
        }

        location /api/job {
103
            proxy_pass http://n9e.server;
U
Ulric Qin 已提交
104 105 106
        }

        location /api/mon {
107
            proxy_pass http://n9e.server;
U
Ulric Qin 已提交
108 109 110
        }

        location /api/index {
111
            proxy_pass http://n9e.server;
U
Ulric Qin 已提交
112 113 114
        }

        location /api/transfer {
115
            proxy_pass http://n9e.server;
U
Ulric Qin 已提交
116 117 118
        }
    }

U
Ulric Qin 已提交
119
}