NGINX-配置例子01

2017-07-10  本文已影响0人  落魄de少爷
worker_processes  1;
events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  0;
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 16 64k;
    gzip_http_version 1.1;
    gzip_comp_level 6;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

    server {
        listen       443;
        server_name  api.example.com;
        ssl                         on;
        ssl_certificate             server-key/server.pem;
        ssl_certificate_key         server-key/server.key;
        ssl_session_timeout         5m;
        ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers                 HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
        ssl_prefer_server_ciphers   on;

        location / {
            proxy_pass http://127.0.0.1:8888;
        }
    }

    server {
        listen       80;
        server_name  redirect.yunpian.easybao.com;
        location / {
            proxy_pass https://sms.yunpian.com;
        }
    }

    server {
        listen       80;
        server_name  redirect.yunpianvoice.example.com;
        location / {
            proxy_pass https://voice.yunpian.com;
        }
    }

    server {
        listen       443;
        server_name  redirect.hs.easybao.com;
        location / {
            proxy_pass https://vopen.hscloud.cn;
        }
    }

    server{
       listen        80;
       server_name redirect.umeng.example.com;
       location / {
           proxy_pass http://msg.umeng.com;
       }
    }

    # Enable nginx status
    server {
       listen 55777;
       location /nginx_status {
       stub_status on;
       access_log   off;
       #allow 127.0.0.1;
       #allow 10.24.34.53;    # Put your zabbix_mon zabbix monitoring server here
       #deny all;
        }
    }
}

stream {
  upstream backend {
    server 122.224.243.187:1567 max_fails=3 fail_timeout=30s;
  }

  server {
    listen 1567;

    proxy_connect_timeout 1s;
    proxy_timeout 3s;
    proxy_pass backend;
  }
}
上一篇下一篇

猜你喜欢

热点阅读