proxy_agent_server.conf 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. upstream agent_server_php_http {
  2. server 172.16.0.42:8001;
  3. }
  4. server {
  5. listen 80;
  6. # listen 443 ssl;
  7. # ssl_certificate /opt/secure/ssl/ipx.mx.crt;
  8. # ssl_certificate_key /opt/secure/ssl/ipx.mx.key;
  9. # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  10. # ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  11. client_max_body_size 20M;
  12. server_name a1s.vip58.xyz;
  13. charset UTF-8;
  14. index default.html default.htm index.html index.htm;
  15. # 防止目录浏览
  16. autoindex off;
  17. # 防止.htaccess文件被请求
  18. location ~ /\.ht {
  19. access_log off;
  20. deny all;
  21. }
  22. # 访问日志:
  23. access_log /var/log/nginx/proxy_agent_server.access.log;
  24. error_log /var/log/nginx/proxy_agent_server.error.log;
  25. # 跨域
  26. set $cors_credentials '';
  27. set $cors_content_type '';
  28. set $cors_content_length '';
  29. if ($http_origin ~ '.+') {
  30. set $cors_credentials 'true';
  31. }
  32. if ($request_method = OPTIONS) {
  33. set $cors_content_type 'text/plain';
  34. set $cors_content_length '0';
  35. }
  36. add_header Access-Control-Allow-Origin $http_origin always;
  37. add_header Access-Control-Allow-Credentials $cors_credentials always;
  38. add_header Access-Control-Allow-Methods $http_access_control_request_method always;
  39. add_header Access-Control-Allow-Headers $http_access_control_request_headers always;
  40. add_header Content-Type $cors_content_type;
  41. add_header Content-Length $cors_content_length;
  42. if ($request_method = OPTIONS) {
  43. return 204;
  44. }
  45. location / {
  46. proxy_pass http://agent_server_php_http;
  47. proxy_http_version 1.1;
  48. proxy_set_header Host $http_host;
  49. proxy_set_header X-Real-IP $remote_addr;
  50. proxy_set_header X-Real-PORT $remote_port;
  51. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  52. proxy_set_header HTTP-REAL-IP $remote_port;
  53. proxy_set_header HTTP-REAL-HOST $host;
  54. proxy_set_header Connection '';
  55. chunked_transfer_encoding off;
  56. proxy_buffering off;
  57. proxy_cache off;
  58. proxy_connect_timeout 120;
  59. proxy_read_timeout 120;
  60. proxy_send_timeout 120;
  61. proxy_buffer_size 32k;
  62. proxy_buffers 4 32k;
  63. proxy_busy_buffers_size 64k;
  64. proxy_temp_file_write_size 256k;
  65. }
  66. }