| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- # 智裁云前端Nginx部署配置示例
- # 方案:同一域名子路径部署
- server {
- listen 80;
- server_name smartcut.example.com;
- # 系统管理后台
- location /platform {
- alias /var/www/smartcut/dist/platform-app;
- try_files $uri $uri/ /platform/index.html;
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
- expires 1y;
- add_header Cache-Control "public, immutable";
- }
- }
- # 工厂管理后台
- location /factory {
- alias /var/www/smartcut/dist/factory-app;
- try_files $uri $uri/ /factory/index.html;
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
- expires 1y;
- add_header Cache-Control "public, immutable";
- }
- }
- # 工人端
- location /worker {
- alias /var/www/smartcut/dist/worker-app;
- try_files $uri $uri/ /worker/index.html;
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
- expires 1y;
- add_header Cache-Control "public, immutable";
- }
- }
- # 后端API代理
- location /api/ {
- proxy_pass http://127.0.0.1:8080;
- 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;
- }
- # 健康检查
- location /health {
- proxy_pass http://127.0.0.1:8080;
- }
- # 监控端点
- location /metrics {
- proxy_pass http://127.0.0.1:8080;
- # 建议添加IP白名单限制
- # allow 10.0.0.0/8;
- # deny all;
- }
- # Gzip压缩
- gzip on;
- gzip_vary on;
- gzip_min_length 1024;
- gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
- }
|