09月18, 2020

云刺绣nginx配置


#user  nginx;
user root;
worker_processes  2;

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


events {
    worker_connections  1024;
}

http {
  client_max_body_size 20M;
  # gzip压缩功能设置
  gzip on;
  gzip_min_length 1k;
  gzip_buffers 4 16k;
  gzip_http_version 1.0;
  gzip_comp_level 6;
  gzip_types text/html text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
  gzip_vary on;
  # 支持下划线的header
  underscores_in_headers on;
    # 刺绣api
    server {
      listen 80;
      server_name cxapi.tecqm.com;
      root /root/workspace/yuncixiu-api-v3.0;
      set $node_port 8001;

      if ( -f $request_filename/index.html ){
        rewrite (.*) $1/index.html break;
      }
      if ( !-f $request_filename ){
        rewrite (.*) /index.js;
      }
      location = /index.js {
        proxy_http_version 1.1;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://127.0.0.1:$node_port$request_uri;
        proxy_redirect off;
      }
      location ~ /static/ {
        etag         on;
        expires      max;
      }
      sendfile        on;

    }

    # 刺绣公众号
    server {
      listen 80;
      server_name cxgh.tecqm.club cxmob.tecqm.club cxgh2.tecqm.club;
      root /root/release/ghao;
       set $node_port 8001;
       location / {
             root /root/release/ghao;
            }

        location ~ /(api|Api) {
              proxy_http_version 1.1;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host $http_host;
              proxy_set_header X-NginX-Proxy true;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection "upgrade";
              proxy_pass http://127.0.0.1:$node_port$request_uri;
              proxy_redirect off;
        }
    }

    # 刺绣公众号
    server {
      listen 80;
      server_name cxadm.tecqm.club;
      root /root/release/admin;

    }

   # 设计师后台
    server {
      listen 80;
      server_name cxdesigner.tecqm.club;
      root /root/release/design;
    }



    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;


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

本文链接:http://zb.qinkeji.cn/post/yun-ci-xiu-nginx-pei-zhi.html

-- EOF --

Comments