nginx-location

http

/usr/local/openresty/nginx/conf/nginx.conf

user nobody;
worker_processes 2;
worker_shutdown_timeout 10s;
worker_rlimit_nofile 104800;
pid /run/nginx.pid;
daemon on;

events {
    multi_accept	on;
    worker_connections 100960;
    use			epoll;
}

http {

    log_format  mainback_cn escape=json '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" $request_time "$request_body"';

    log_format  mainback_en  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" $request_time "$request_body"';

   log_format mainback '$http_x_request_id $remote_addr - $remote_user [$time_local] "http-host=$host" "elapsed=${request_time}s" "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for" "$http_origin" "$upstream_response_time" "$upstream_addr"';


    log_format main '$http_x_request_id $remote_addr - $remote_user [$time_local] "http-host=$host" "elapsed=${request_time}s" "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for" "$http_origin" "$upstream_response_time" "$upstream_addr" "$http_x_request_uid" "$upstream_svc"';

    access_log  /var/log/nginx/access.log  main;
    error_log /var/log/nginx/error.log debug;

    resolver 10.xx.xx.xx;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   3600;
    types_hash_max_size 2048;
    server_names_hash_max_size  1024;
    server_names_hash_bucket_size 128;
    server_tokens off;

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

    gzip  on;
    gzip_comp_level 2;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types  text/plain application/json application/javascript application/x-javascript text/javascript application/xml application/xml_rss text/xml text/css;
    gzip_vary on;

    ssl_protocols  TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_early_data on;

    client_max_body_size	40M;
    client_body_buffer_size	512M;

    lua_shared_dict eeboag_limit_req_shared 100m;
    lua_package_path "/usr/local/openresty/lualib/?.lua;/usr/local/openresty/nginx/eeboag/core/?.lua;/usr/local/openresty/nginx/eeboag/consul/?.lua;/usr/local/openresty/nginx/eeboag/conf/?.lua;/usr/local/openresty/nginx/eeboag/auth/?.lua;/usr/local/openresty/nginx/eeboag/subsys/?.lua;/usr/local/openresty/nginx/eeboag/redis/?.lua;/usr/local/openresty/nginx/eeboag/limit/?.lua;;";
    lua_package_cpath "/usr/local/openresty/lualib/?.so;;";

    init_by_lua_block {
            eebogate = require 'eeboag'
            -- conf_load = require 'config_loader'
    }
    init_worker_by_lua_block{
            uriconf = require 'uriconf'
	    dbconfig = require 'dbconfig'
	    configs = require 'configs'
            configs.init_worker()
    }

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


server

    server {
        set $upstream_svc "wework-h5";
        listen       80;
        listen       18052;
        listen          443 ssl;
        server_name	wework-h5-dev.test.com;
        set $user_type "/data/wwwRoot/hr-fe/mp2/";
        root $user_type;

        index        index.html;


        ssl_certificate           /etc/nginx/cert.d/test.com.crt;
        ssl_certificate_key       /etc/nginx/cert.d/test.com.key;

	add_header 'Access-Control-Allow-Origin' "$http_origin";
        add_header 'Access-Control-Allow-Headers' 'accept,os,accesstoken,content-Type,X-Requested-With,Authorization,apptype,appkey,devid,token,uid,versioncode,versionname,mfg,x-request-id,x-request-uid,X-PLATFORM';
        add_header 'Access-Control-Max-Age' '2592000';
        add_header 'Access-Control-Allow-Methods' 'GET, PUT, OPTIONS, POST, DELETE';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'X-Content-Type-Options' 'nosniff';
        add_header 'X-XSS-Protection' '1; mode=block';
        add_header 'X-Frame-Options' 'ALLOW-FROM https://h5-dev.test.com/';
        add_header 'X-Frame-Options' 'ALLOW-FROM https://wework-h5-dev.test.com/';
        add_header 'X-Frame-Options' 'ALLOW-FROM http://localhost:8200/';

        ssl_session_cache  builtin:1000  shared:SSL:10m;
        ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        ssl_prefer_server_ciphers on;

        access_log /var/log/nginx/wework-h5-dev.test.com-access.log main;
        error_log /var/log/nginx/wework-h5-dev.test.com-error.log error;

        client_header_buffer_size 256k;
        large_client_header_buffers 4 256k;
        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_read_timeout  3600;
        proxy_connect_timeout       1;
        proxy_buffering off;

        location / {
           etag off;
           expires 0;

        }

        location ~ .*\.(html|xml|txt|ico)$ {
            etag off;
            if_modified_since off;
            add_header Last-Modified "";
            expires 0;
        }

        location /update.json {
                default_type application/json;
                return 200 '{"version":"1.3.4"}';
        }

        include /etc/nginx/conf.d/wework-h5-dev.test.com/*.conf;
        include /etc/nginx/conf.d/hr-fe/hr-business-wework-h5/*.conf;

        error_page  404              /404.html;
        location = /40x.html {
        }

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


location

include /etc/nginx/conf.d/hr-fe/hr-business-wework-h5/

location /self-service/ {

    root /data/wwwROOT/dm.fe.self_service;
    index index.html;
    etag off;
    if ($request_uri ~* "^((\/[a-zA-Z0-9\-\_]+)+\/?\?.*)|((\/[a-zA-Z0-9\-\_]+)+\/?)$") {
        add_header Cache-Control no-cache;
        add_header Last-Modified "";
        rewrite ^(.+)$ /index.html break;
    }
    
    location ~ .*\.(html|xml|txt)$ {
        etag off;
        if_modified_since off;
        add_header Last-Modified "";
        expires 0;
    }

}

location /browser {
    etag off;
    add_header Cache-Control no-cache;
    add_header Last-Modified "";
    #root /data/wwwRoot/hr-fe/hr-h5; 
    alias /data/wwwRoot/hr-fe/hr-h5/browser/;

    location ~ .*\.(html|xml|txt)$ {
        #expires off;
        etag off;
        if_modified_since off;
        add_header Last-Modified "";
        expires 0;
    }
}

location /recruitment {
    proxy_pass http://2haohr-h5-major-server;
}
posted @ 2023-03-07 16:20  爱折腾的大臭臭  阅读(50)  评论(0编辑  收藏  举报