| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- upstream chuji_ios_server_http_1 {
- server 137.220.142.147:9503;
- }
- upstream chuji_ios_server_ws_1 {
- server 137.220.142.147:9601;
- }
- server {
- listen 80;
- listen [::]:80;
- client_max_body_size 20K;
- # listen 443 ssl;
- # listen [::]:443 ssl;
- # ssl_certificate /etc/nginx/ssl/nurftlg.cn/fullchain.cer;
- # ssl_certificate_key /etc/nginx/ssl/nurftlg.cn/nurftlg.cn.key;
- # ssl_verify_client off;
- # ssl_prefer_server_ciphers on;
- # ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
- # ssl_ciphers HIGH:!aNULL:!MD5:ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
- # ssl_session_cache shared:SSL:20m;
- # ssl_session_tickets off;
- server_name pg1-api1.cj163.xyz pg1-api.cj163.xyz pg2-api.cj263.xyz pg3-api.cj777.xyz;
- access_log /var/log/nginx/chuji_ios_api.access.log;
- error_log /var/log/nginx/chuji_ios_api.error.log;
- real_ip_header X-Forwarded-For;
- set_real_ip_from 0.0.0.0/0;
- # 跨域
- set $cors_credentials '';
- set $cors_content_type '';
- set $cors_content_length '';
- if ($http_origin ~ '.+') {
- set $cors_credentials 'true';
- }
- if ($request_method = OPTIONS) {
- set $cors_content_type 'text/plain';
- set $cors_content_length '0';
- }
- add_header Access-Control-Allow-Origin $http_origin always;
- add_header Access-Control-Allow-Credentials $cors_credentials always;
- add_header Access-Control-Allow-Methods $http_access_control_request_method always;
- add_header Access-Control-Allow-Headers $http_access_control_request_headers always;
- add_header Content-Type $cors_content_type;
- add_header Content-Length $cors_content_length;
- if ($request_method = OPTIONS) {
- return 204;
- }
- location / {
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_set_header REMOTE_ADD $remote_addr;
- proxy_set_header Upgrade $http_upgrade;
- proxy_pass http://chuji_ios_server_http_1; #后端api容器地址
- proxy_redirect off;
- }
- location /ws {
- proxy_pass http://chuji_ios_server_ws_1;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- rewrite /ws/(.*) /$1 break;
- proxy_redirect off;
- }
- }
|