|
1234567891011121314151617181920212223242526272829303132333435363738 |
- server {
- listen 80;
- server_name your-domain.com; # 替换为你的域名
-
- # 日志配置
- access_log /var/log/nginx/crawling-service.access.log;
- error_log /var/log/nginx/crawling-service.error.log;
-
- # 安全配置
- add_header X-Frame-Options "SAMEORIGIN";
- add_header X-XSS-Protection "1; mode=block";
- add_header X-Content-Type-Options "nosniff";
-
- # 反向代理配置
- location / {
- proxy_pass http://localhost:8991;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection 'upgrade';
- proxy_set_header Host $host;
- proxy_cache_bypass $http_upgrade;
- 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;
-
- # 超时设置
- proxy_connect_timeout 60s;
- proxy_send_timeout 60s;
- proxy_read_timeout 60s;
- }
-
- # 静态文件缓存
- location /screenshots {
- alias /path/to/your/crawling-service/screenshots; # 替换为实际路径
- expires 7d;
- add_header Cache-Control "public, no-transform";
- }
- }
|