nginx代理123.com

upstream apireport {
  server 172.18.2.60:18083;
}


server {
  listen 80;
  listen 443 ssl http2;
  server_name 123.com;
  access_log logs/report.access.log;
  error_log logs/report.error.log;
  ssl_certificate cert/214602433430717.pem;
  ssl_certificate_key cert/214602433430717.key;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;


  #api-report
  location / {
    add_header Access-Control-Allow-Origin '*' always;
    add_header Access-Control-Allow-Methods 'GET, POST,PUT, OPTIONS,DELETE';
    add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,token,Authorization';
    if ($request_method = 'OPTIONS') {
      return 204;
    }
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_pass http://apireport/;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
    proxy_connect_timeout 60s;
    proxy_read_timeout 600s;
    proxy_send_timeout 200s;
  }


}

你可能感兴趣的:(Linux,nginx)