nginx.conf 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. user root;
  2. worker_processes 5;
  3. events {
  4. worker_connections 2048;
  5. }
  6. http {
  7. include mime.types;
  8. default_type application/octet-stream;
  9. server_tokens off;
  10. sendfile on;
  11. keepalive_timeout 65;
  12. gzip on;
  13. gzip_disable "msie6";
  14. gzip_min_length 1k;
  15. gzip_buffers 4 16k;
  16. gzip_http_version 1.0;
  17. gzip_comp_level 3;
  18. gzip_types text/plain
  19. application/x-javascript
  20. ext/css
  21. application/xml
  22. text/javascript
  23. image/jpeg
  24. image/gif
  25. image/png
  26. image/svg+xml
  27. application/font-woff
  28. application/javascript;
  29. gzip_vary on;
  30. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  31. '$status $body_bytes_sent "$http_referer" '
  32. '"$http_user_agent" "$http_x_forwarded_for"';
  33. server {
  34. listen 8181;
  35. charset utf-8;
  36. index index.html;
  37. root /usr/share/nginx/html/;
  38. location ~ .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$ {
  39. expires 7d;
  40. add_header Pragma public;
  41. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  42. }
  43. location ${__WEB_CONTEXT_PATH}/ {
  44. try_files $uri $uri/ /index.html;
  45. access_log on;
  46. }
  47. location ${__WEB_CONTEXT_PATH}/mark-tool/* {
  48. alias /usr/share/nginx/html/mark-tool/;
  49. index index.html;
  50. try_files $uri $uri/ /index.html;
  51. }
  52. location /data_images/portal/ {
  53. proxy_pass ${__GATEWAY_URL}/aiSquare/openApi/appscene/data_images/portal/;
  54. expires 7d;
  55. add_header Pragma public;
  56. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  57. }
  58. location ^~ ${__WEB_CONTEXT_PATH}/assets/ {
  59. alias /usr/share/nginx/html/assets/;
  60. expires max;
  61. add_header Pragma public;
  62. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  63. }
  64. location ^~ ${__WEB_CONTEXT_PATH}/images/ {
  65. alias /usr/share/nginx/html/images/;
  66. add_header Pragma public;
  67. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  68. }
  69. location ^~ ${__WEB_CONTEXT_PATH}/docs/ {
  70. alias /usr/share/nginx/html/docs/;
  71. add_header Pragma public;
  72. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  73. }
  74. location /aiSquare/openApi/uc/oauth/ {
  75. proxy_pass ${__GATEWAY_URL}/aiSquare/openApi/uc/oauth/;
  76. proxy_set_header Host $host;
  77. proxy_set_header X-Real-IP $remote_addr;
  78. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  79. proxy_set_header X-Forwarded-Proto $scheme;
  80. }
  81. location /aiSquare/openApi/ {
  82. proxy_pass ${__GATEWAY_URL}/aiSquare/openApi/;
  83. proxy_set_header Host $host;
  84. proxy_set_header X-Real-IP $remote_addr;
  85. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  86. proxy_set_header X-Forwarded-Proto $scheme;
  87. }
  88. error_page 403 404 405 ${__WEB_CONTEXT_PATH}/notFound;
  89. error_page 500 502 503 504 ${__WEB_CONTEXT_PATH}/error;
  90. location = ${__WEB_CONTEXT_PATH}/notFound {
  91. root /usr/share/nginx/html;
  92. }
  93. location /aiSquare/logs-temp/ {
  94. alias /data/ai_lab/ai_web/logs/;
  95. charset utf-8,gbk;
  96. autoindex on;
  97. autoindex_exact_size on;
  98. autoindex_localtime on;
  99. }
  100. access_log /data/ai_lab/ai_web/logs/web-access.log main;
  101. }
  102. }