153 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			153 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|   | 
 | |||
|  | # -----------------单后端----------------------- | |||
|  | server { | |||
|  |     listen 443 ssl; | |||
|  |     server_name s2.jennie.im; | |||
|  | 
 | |||
|  |     ssl_certificate /data/tengine/certificate/jennie.im.crt; | |||
|  |     ssl_certificate_key /data/tengine/certificate/jennie.im.key; | |||
|  |     ssl_protocols TLSv1.2 TLSv1.3; | |||
|  |     ssl_ciphers HIGH:!aNULL:!MD5; | |||
|  | 
 | |||
|  |     # 单独日志文件 | |||
|  |     access_log /data/tengine/logs/s2_jennie_im_access.log; | |||
|  |     error_log  /data/tengine/logs/s2_jennie_im_error.log; | |||
|  | 
 | |||
|  | 
 | |||
|  |     location /api/ { | |||
|  |         proxy_pass http://10.0.0.5:8001; | |||
|  |         proxy_set_header Host $host; | |||
|  |         proxy_set_header X-Real-IP $remote_addr; | |||
|  |         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||
|  |         proxy_set_header X-Forwarded-Proto $scheme; | |||
|  | 
 | |||
|  |         proxy_buffering off; | |||
|  |         proxy_cache off; | |||
|  |         proxy_http_version 1.1; | |||
|  |         proxy_set_header Connection ""; | |||
|  | 
 | |||
|  |         add_header 'Access-Control-Allow-Origin' "$http_origin" always; | |||
|  |         add_header 'Access-Control-Allow-Credentials' 'true' always; | |||
|  |         add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always; | |||
|  |         add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always; | |||
|  | 
 | |||
|  |         if ($request_method = OPTIONS ) { | |||
|  |             return 204; | |||
|  |         } | |||
|  |     } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |     # 前端静态文件 | |||
|  |     location / { | |||
|  |         root /data/tengine/html/jennie-damon-frontend/dist; | |||
|  |         index index.html; | |||
|  |         try_files $uri $uri/ /index.html; | |||
|  |     } | |||
|  | 
 | |||
|  |     # 缓存控制,确保 JS 文件不缓存老内容 | |||
|  |     location ~* \.(js|css|woff2|json|svg)$ { | |||
|  |         root /data/tengine/html/jennie-damon-frontend/dist; | |||
|  |        # expires off; | |||
|  |         add_header Cache-Control "no-cache, no-store, must-revalidate"; | |||
|  |     } | |||
|  | 
 | |||
|  | 
 | |||
|  |     # 打到国内sit的agent.jar包 | |||
|  |     location /sit-api/agent/ { | |||
|  |         proxy_pass http://106.53.194.199:8070; | |||
|  |         proxy_set_header Host 106.53.194.199; | |||
|  |         proxy_set_header X-Real-IP $remote_addr; | |||
|  |         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||
|  | 
 | |||
|  |         proxy_intercept_errors off; | |||
|  |         proxy_buffering off; | |||
|  |         proxy_cache off; | |||
|  |         proxy_set_header Connection keep-alive; | |||
|  | 
 | |||
|  |         add_header 'Access-Control-Allow-Origin' "$http_origin" always; | |||
|  |         add_header 'Access-Control-Allow-Credentials' 'true' always; | |||
|  |         add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always; | |||
|  |         add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always; | |||
|  | 
 | |||
|  |         if ($request_method = OPTIONS ) { | |||
|  |             return 204; | |||
|  |         } | |||
|  |     } | |||
|  | 
 | |||
|  | 
 | |||
|  |     # 错误页面 | |||
|  |     error_page 500 502 503 504 /50x.html; | |||
|  |     location = /50x.html { | |||
|  |         root /data/tengine/html/jennie-damon-frontend/dist; | |||
|  |     } | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | # ------------------------------------ | |||
|  | 
 | |||
|  | 
 | |||
|  | # ------------前端缓存策略------------------------ | |||
|  | # 主入口 HTML 不缓存,确保每次都能加载到最新引用 | |||
|  | location = /index.html { | |||
|  |     root /data/tengine/html/jennie-damon-frontend/dist; | |||
|  |     add_header Cache-Control "no-cache, no-store, must-revalidate"; | |||
|  | } | |||
|  | 
 | |||
|  | # 所有带 hash 的静态资源(默认构建出来的 .js/.css/woff2 文件等),设置长缓存 | |||
|  | location ~* \.(js|css|woff2|json|svg|png|jpg|jpeg|gif|ico|ttf|otf|eot|mp4|webm|webp)$ { | |||
|  |     root /data/tengine/html/jennie-damon-frontend/dist; | |||
|  |     add_header Cache-Control "public, max-age=31536000, immutable"; | |||
|  | } | |||
|  | # ------------------前端缓存策略------------------ | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | # 主入口 HTML 不缓存,确保每次都能加载到最新引用 | |||
|  | location = /index.html { | |||
|  |     root /data/tengine/html/jennie-damon-frontend/dist; | |||
|  |     add_header Cache-Control "no-cache, no-store, must-revalidate"; | |||
|  | } | |||
|  | 
 | |||
|  | # 所有带 hash 的静态资源(默认构建出来的 .js/.css/woff2 文件等),设置长缓存 | |||
|  | location ~* \.(js|css|woff2|json|svg|png|jpg|jpeg|gif|ico|ttf|otf|eot|mp4|webm|webp)$ { | |||
|  |     root /data/tengine/html/jennie-damon-frontend/dist; | |||
|  |     add_header Cache-Control "public, max-age=31536000, immutable"; | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | #---------------s3原本------------------------ | |||
|  | # 前端静态文件 | |||
|  | location / { | |||
|  |     root /data/tengine/html/qmm_sourcing_agents_web/dist; | |||
|  |     index index.html; | |||
|  |     try_files $uri $uri/ /index.html; | |||
|  | } | |||
|  | # 缓存控制,确保 JS 文件不缓存老内容 | |||
|  | location ~* \.(js|css|woff2|json|svg)$ { | |||
|  |     root /data/tengine/html/qmm_sourcing_agents_web/dist; | |||
|  |     # expires off; | |||
|  |     add_header Cache-Control "no-cache, no-store, must-revalidate"; | |||
|  | } | |||
|  | #-----------------s3原本---------------------- | |||
|  | 
 | |||
|  | 
 | |||
|  | # 前端静态文件 | |||
|  |     location = /index.html { | |||
|  |         root /data/tengine/html/qmm_sourcing_agents_web/dist; | |||
|  |         add_header Cache-Control "no-cache, no-store, must-revalidate"; | |||
|  |     } | |||
|  |     # 精确匹配 index.html,禁用缓存 | |||
|  |     location = /index.html { | |||
|  |         root /data/tengine/html/qmm_sourcing_agents_web/dist; | |||
|  |         add_header Cache-Control "no-cache, no-store, must-revalidate"; | |||
|  |     } | |||
|  |     # 静态资源开启长缓存(带 hash) | |||
|  |     location ~* \.(js|css|woff2|json|svg|png|jpg|jpeg|gif|ico|ttf|otf|eot|mp4|webm|webp)$ { | |||
|  |         root /data/tengine/html/qmm_sourcing_agents_web/dist; | |||
|  |         add_header Cache-Control "public, max-age=31536000, immutable"; | |||
|  |     } |