server { listen 80; root /usr/share/nginx/html; # root /data/app/iotlcmadmin-web-ui/dist; index index.html; charset utf-8; client_max_body_size 200m; access_log /data/logs/nginx/access_iotlcmadminui.log; error_log /data/logs/nginx/error_iotlcmadminui.log; # 解决history路由刷新404 location / { try_files $uri $uri/ /index.html; } location /api/ { proxy_set_header Connection upgrade; proxy_set_header Upgrade $http_upgrade; proxy_http_version 1.1; chunked_transfer_encoding off; proxy_pass http://iotlcm-admin-svr:8008/api/v1/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # 开启gzip压缩 gzip on; gzip_types text/plain application/javascript text/css application/json; location /upload/ { alias /data/app/iotlcmadmin-web-svc/upload/; } location /app/upload/ { alias /data/app/iotlcmadmin-web-svc/upload/; } }