server { listen 80 default_server; server_name _; # 启动Gzip Json模式 ###################################################### gzip_http_version 1.0; # gzip支持http协议 proxy 必须用 gzip on; gzip_vary on; gzip_proxied any; gzip_static on; gzip_comp_level 4; gzip_min_length 256; gzip_buffers 4 8k; gzip_types text/html text/plain application/javascript application/x-javascript text/css application/xml application/json; location /parse/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:61337/parse/; proxy_redirect off; } location /api/parse/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:61337/parse/; proxy_redirect off; } root /var/www/edu-textbook/; location /{ try_files $uri $uri/ /index.html?$query_string; } }