Nginx配置

@(技术-Linux)[Linux, Nginx, nginx]

nginx的nginx.conf配置

#user  nobody;
worker_processes  2;

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

#pid        logs/nginx.pid;

events {
     use epoll;
        worker_connections  32768;
}


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

    #keepalive_timeout  0;
    keepalive_timeout  100;

    proxy_connect_timeout    100;
    proxy_read_timeout       100;
    proxy_send_timeout       100;

    gzip  on;
    limit_req_zone $binary_remote_addr zone=one:10m rate=20r/s;

    server {
        listen 80;
        server_name  yongche.gzeliu.com;

        charset utf-8;
        limit_req zone=one burst=45 nodelay;

        location /api/excel/ {
                proxy_pass   http://127.0.0.1:8080;
                proxy_connect_timeout    600;
                proxy_read_timeout       600;
                proxy_send_timeout       600;
                client_max_body_size  200m;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Real-Port $remote_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location / {
                proxy_pass   http://127.0.0.1:8080;
                client_max_body_size  200m;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Real-Port $remote_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        #location = /status {
        #    stub_status on;
        #    access_log off;
        #    auth_basic "NginxStatus";
        #}

    location =/MP_verify_tXjqZCoUVjvAJqoo.txt {
            root  html;
        }
   }

    server {
        listen       443 ssl;
        server_name  yongche.gzeliu.com;
        ssl   on;
        ssl_certificate      /usr/local/nginx/server.crt;
        ssl_certificate_key  /usr/local/nginx/server.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            proxy_pass   http://127.0.0.1:8080;
            client_max_body_size  200m;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Real-Port $remote_port;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

}

jbearmen
31 声望0 粉丝

引用和评论

0 条评论