• 无状态nginx配置
  • nginx.conf覆盖容器配置
    nginx.conf 代码:
    
    events {
        worker_connections  1024;
    }
    
    
    http {
        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;
        error_log  /var/log/nginx/error.log;
    
        sendfile        on;
        #tcp_nopush     on;
    
        keepalive_timeout  65;
    
        #gzip  on;
    
        include /etc/nginx/conf.d/*.conf;
    
    	# C++网关
    	server
    	{
    		listen 30001;
    		add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
                    add_header X-XSS-Protection "1; mode=block";
                    add_header X-Frame-Options "SAMEORIGIN always";
                    add_header X-Content-Type-Options "nosniff";
    		# 转发websocket需要的设置
    		proxy_set_header X-Real_IP $remote_addr;
    		proxy_set_header Host $host;
    		proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
    		proxy_http_version 1.1;
    		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection 'upgrade';
    		location / {
                           proxy_set_header Connection 'keep-alive';
                           proxy_read_timeout 6000;
    		       proxy_pass http://gatewayserver.rz-dt:30001/;
    		}
    		location /weixin/ {
    			proxy_pass http://ossaccessserver.rz-dt:30002/weixin/;
    		}
    		location /upload/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/upload/;
    		}
    		location /events/ {
    			proxy_pass http://sseserver.rz-dt:30001/events/;
    		}
    		location /getEsignSignUrl/ {
    			proxy_pass http://fileserver.rz-dt:30001/getEsignSignUrl/;
    		}
    		location /public/ {
    			proxy_pass http://sseserver.rz-dt:30001/public/;
    		}
    		location /clean_download/ {
    			proxy_pass http://fileserver.rz-dt:30001/clean_download/;
    		}
    		location /clean_download_data/ {
    			proxy_pass http://fileserver.rz-dt:30001/clean_download_data/;
    		}
    		location /getOssSignUrl/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/getOssSignUrl/;
    		}
    		location /getStsToken/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/getStsToken/;
    		}
    		location /getPreviewUrl/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/getPreviewUrl/;
    		}
    		location /change_image_background_color/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/change_image_background_color/;
    		}
    		location /docx2pdf/ {
    			client_max_body_size 50M;
    			client_body_buffer_size 50M;
    			proxy_pass http://fileserver.rz-dt:30001/docx2pdf/;
    		}
    		location /getPdfPageNum/ {
    			proxy_pass http://fileserver.rz-dt:30001/getPdfPageNum/;
    		}
    		location /upload_esign/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://electronicpythonserver.rz-dt:30001/upload_esign;
    		}
    		location /elec_python/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://electronicpythonserver.rz-dt:30001/;
    		}
    		location /download/ {
    			proxy_pass http://fileserver.rz-dt:30001/download/;
    		}
    		location /fdd_notify/ {
    			proxy_pass http://electroniccbpythonserver.rz-dt:30001/;
    		}
    		# location /hdwd_download/ {
    		# 	client_max_body_size 1024M;
    		# 	client_body_buffer_size 1024M;
    		# 	proxy_pass http://investorrelationpythonserver.rz-dt:30001/download_interqa;
    		# }
    
    		# # 通讯录
            # location /address_book/ {
            #     client_max_body_size 1024M;
            #     client_body_buffer_size 1024M;
    		# 	proxy_pass http://addressbookpythonserver.rz-dt:30001/;
    		# }
    
    		location /get_doc_info/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://espythonserver.rz-dt:30001/get_doc_info;
    		}
    
    		location /get_id_list/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://espythonserver.rz-dt:30001/get_id_list;
    		}
    		access_log /var/log/nginx/way.zhi.real.com.log;
    	}
    	
    	# 智库web端v2
    	server
    	{
    		listen 30002;
    		add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
                    #add_header Content-Security-Policy "default-src 'self' http://zhi.real.com; font-src 'self' data:; script-src unsafe-inline; script-src-elem unsafe-inline";
                    add_header X-XSS-Protection "1; mode=block";
                    add_header X-Frame-Options "SAMEORIGIN always";
                    add_header X-Content-Type-Options "nosniff";
    
    		# 转发websocket需要的设置
    		proxy_set_header X-Real_IP $remote_addr;
    		proxy_set_header Host $host;
    		proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
    		proxy_http_version 1.1;
    		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection 'upgrade';
    		location / {
    			proxy_pass http://frontdongmi-official.rz-dt:30001/;
    		}
                    location /pdf_web/ {
    			proxy_pass http://pdfwebserver.rz-dt:30001/pdf_web/;
    		}
                    location /weixinproxy/ {
    			proxy_pass http://weixinproxyserver.rz-dt:30001/;
    		}
                    location /events/ {
    			proxy_pass http://sseserver.rz-dt:30001/events/;
    		}
                    location /public/ {
    			proxy_pass http://sseserver.rz-dt:30001/public/;
    		}
                    location /office_web/ {
                    proxy_set_header X-Real_IP $remote_addr;
    		proxy_set_header Host view.officeapps.live.com;
    		proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
    		proxy_http_version 1.1;
    		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection 'upgrade';
    		proxy_pass https://view.officeapps.live.com/;
    		}
                    location /weapp_esg/ {
    			proxy_pass http://pdfwebserver.rz-dt:30001/weapp_esg/;
    		}
                    location /zhiku/ {
    			proxy_pass http://frontdongmi.rz-dt:30001/zhiku/;
                           #proxy_pass http://frontdongmi-mv-diag.rz-dt:30001/diag/;
    		}
                    location /im/ {
    			proxy_pass http://frontdongmi-zhixin.rz-dt:30001/im/;
    		}
                    location /managePlatForm/ {
    			proxy_pass http://frontdongmi-manager.rz-dt:30001/managePlatForm/;
    		}
                    location /cockpit/ {
    			proxy_pass http://frontdongmi-cockpit.rz-dt:30001/cockpit/;
    		}
                    location /video/ {
    			proxy_pass http://frontdongmi-video.rz-dt:30001/video/;
    		}
                    location /page/ {
    			proxy_pass http://frontdongmi-page.rz-dt:30001/page/;
    		}
                    location /visualization/ {
    			proxy_pass http://frontdongmi-visualization.rz-dt:30001/visualization/;
    		}
                    location /h5/ {
    			proxy_pass http://frontdongmi-h5.rz-dt:30001/h5/;
    		}
                    location /diag/ {
    			proxy_pass http://frontdongmi-mv-diag.rz-dt:30001/diag/;
    		} 
                    location /h5_weApp/ {
    			proxy_pass http://frontdongmi-h5-weapp.rz-dt:30001/h5_weApp/;
    		}
                    location /eSign/ {
    			proxy_pass http://frontdongmi-esign.rz-dt:30001/eSign/;
                    }
                    location /esign-h5/ {
    			proxy_pass http://frontdongmi-esign-h5.rz-dt:30001/esign-h5/;
    		}
                    location /m/ {
    			proxy_pass http://frontdongmi-h5.rz-dt:30001/m/;
    		}
                    location /marketData/ {
                            proxy_pass http://frontdongmi-marketdata.rz-dt:30001/marketData/;
                    }
                    location /weixin/ {
    			proxy_pass http://ossaccessserver.rz-dt:30002/weixin/;
                    }
                    location /.well-known/ {
    			proxy_pass http://ossaccessserver.rz-dt:30002/.well-known/;
                    }
                    location /getStsToken/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/getStsToken/;
                    }
                    location /rzgateway/ {
                            client_max_body_size 1024M;
                            client_body_buffer_size 1024M;
    			#proxy_pass http://47.101.207.23:8082/;
                            proxy_pass http://application-gateway.rz-dt:8080/;
    		}
                    location /rzwebgateway/ {
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    			add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    
    			if ($request_method = 'OPTIONS') {
    				return 200;
    			}
                            client_max_body_size 1024M;
                            client_body_buffer_size 1024M;
                            proxy_pass http://realize-gateway.rz-dt:9300/;
    		}
                    location /gateway/ {
                           proxy_set_header Connection 'keep-alive';
    			proxy_pass http://gatewayserver.rz-dt:30001/;
    		}
    		location /upload/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/upload/;
    		}
                    location /getPreviewUrl/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/getPreviewUrl/;
    		}
    		location /upload_esign/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://electronicpythonserver.rz-dt:30001/upload_esign;
    		}
    		location /download/ {
    			proxy_pass http://fileserver.rz-dt:30001/download/;
    		}
    		location /fdd_notify/ {
    			proxy_pass http://electroniccbpythonserver.rz-dt:30001/;
    		}
    
                    location /qiyu_notify/ {
    	            proxy_pass http://electroniccbpythonserver.rz-dt:30001/;
                    }
    		access_log /var/log/nginx/zhi.real.com.log;
    	}
    
            # 智库web端v1
    	server
    	{
    		listen 30006;
    		add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
                    #add_header Content-Security-Policy "default-src 'self' http://zhi.real.com; font-src 'self' data:; script-src unsafe-inline; script-src-elem unsafe-inline";
                    add_header X-XSS-Protection "1; mode=block";
                    add_header X-Frame-Options "SAMEORIGIN always";
                    add_header X-Content-Type-Options "nosniff";
    
    		# 转发websocket需要的设置
    		proxy_set_header X-Real_IP $remote_addr;
    		proxy_set_header Host $host;
    		proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
    		proxy_http_version 1.1;
    		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection 'upgrade';
    		location / {
    			proxy_pass http://frontdongmi-official-v1.rz-dt:30001/;
    		}
                    location /pdf_web/ {
    			proxy_pass http://pdfwebserver.rz-dt:30001/pdf_web/;
    		}
                    location /weapp_esg/ {
    			proxy_pass http://pdfwebserver.rz-dt:30001/weapp_esg/;
    		}
                    location /zhiku/ {
    			proxy_pass http://frontdongmi-v1.rz-dt:30001/zhiku/;
    		}
                    location /managePlatForm/ {
    			proxy_pass http://frontdongmi-manager.rz-dt:30001/managePlatForm/;
    		}
                    location /video/ {
    			proxy_pass http://frontdongmi-video.rz-dt:30001/video/;
    		}
                    location /page/ {
    			proxy_pass http://frontdongmi-page.rz-dt:30001/page/;
    		}
                    location /visualization/ {
    			proxy_pass http://frontdongmi-visualization.rz-dt:30001/visualization/;
    		}
                    location /h5/ {
    			proxy_pass http://frontdongmi-h5.rz-dt:30001/h5/;
    		}
                    location /h5_weApp/ {
    			proxy_pass http://frontdongmi-h5-weapp.rz-dt:30001/h5_weApp/;
    		}
                    location /m/ {
    			proxy_pass http://frontdongmi-h5.rz-dt:30001/m/;
    		}
                    location /marketData/ {
                            proxy_pass http://frontdongmi-marketdata.rz-dt:30001/marketData/;
                    }
                    location /weixin/ {
    			proxy_pass http://ossaccessserver.rz-dt:30002/weixin/;
                    }
                    location /.well-known/ {
    			proxy_pass http://ossaccessserver.rz-dt:30002/.well-known/;
                    }
                    location /getStsToken/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/getStsToken/;
                    }
                    location /rzgateway/ {
                            client_max_body_size 1024M;
                            client_body_buffer_size 1024M;
    			#proxy_pass http://47.101.207.23:8082/;
                            #proxy_pass http://139.224.134.101:8082/;
                            proxy_pass http://application-gateway.rz-dt:8080/;
    		}
                    location /rzwebgateway/ {
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    			add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    
    			if ($request_method = 'OPTIONS') {
    				return 200;
    			}
                            client_max_body_size 1024M;
                            client_body_buffer_size 1024M;
                            proxy_pass http://realize-gateway.rz-dt:9300/;
    		}
                    location /gateway/ {
                           proxy_set_header Connection 'keep-alive';
    			proxy_pass http://gatewayserver.rz-dt:30001/;
    		}
    		location /upload/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/upload/;
    		}
                    location /getPreviewUrl/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://fileserver.rz-dt:30001/getPreviewUrl/;
    		}
    		location /upload_esign/ {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
    			proxy_pass http://electronicpythonserver.rz-dt:30001/upload_esign;
    		}
    		location /download/ {
    			proxy_pass http://fileserver.rz-dt:30001/download/;
    		}
    		location /fdd_notify/ {
    			proxy_pass http://electroniccbpythonserver.rz-dt:30001/;
    		}
    		access_log /var/log/nginx/zhiku-v1.zhi.real.com.log;
    	}
    	
    	# 荣正网关
    	server
    	{
    		listen 30003;
    		add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    		# 转发websocket需要的设置
    		proxy_set_header X-Real_IP $remote_addr;
    		proxy_set_header Host $host;
    		proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
    		proxy_http_version 1.1;
    		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection 'upgrade';
    		location / {
    			client_max_body_size 1024M;
    			client_body_buffer_size 1024M;
                            proxy_pass http://realize-auth.rz-dt:9301/;
    		}
    		access_log /var/log/nginx/rzgateway.zhi.real.com.log;
    	}
    
            # 采集平台
    server
    {
        listen 30004;
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
        # 转发websocket需要的设置
        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        location / {
            proxy_pass http://spiderflow.rz-dt:30001/;
        }
        access_log /var/log/nginx/spider.zhi.real.com.log;
    }
    
        # 视频营销
    	server
    	{
    		listen 30005;
    		add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    		# 转发websocket需要的设置
    		proxy_set_header X-Real_IP $remote_addr;
    		proxy_set_header Host idtcdn.oss-cn-hangzhou.aliyuncs.com;
    		proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
    		proxy_http_version 1.1;
    		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection 'upgrade';
    		location / {
    			proxy_pass http://idtcdn.oss-cn-hangzhou.aliyuncs.com/;
    		}
    		access_log /var/log/nginx/video.zhi.real.com.log;
    	}
    
        # 文件服务
        server
        {
    	listen 30007;
    	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    	proxy_set_header X-Real_IP $remote_addr;
    	proxy_set_header Host $host;
    	proxy_set_header X_Forward_For $proxy_add_x_forwarded_for;
    	proxy_http_version 1.1;
    	proxy_set_header Upgrade $http_upgrade;
    	proxy_set_header Connection 'upgrade';
    	location / {
                client_max_body_size 50M;
                client_body_buffer_size 50M;
    	    proxy_pass http://fileserver.rz-dt:30001/;
    	}
    	access_log /var/log/nginx/file.zhi.real.com.log;
        }
    }

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐