123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
-
- server {
- listen 80 default_server;
- server_name _;
-
- gzip_http_version 1.0;
- 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 /api {
- if ($request_method = 'OPTIONS') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
-
-
-
- add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
-
-
-
- add_header 'Access-Control-Max-Age' 1728000;
- add_header 'Content-Type' 'text/plain; charset=utf-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- if ($request_method = 'POST') {
- add_header 'Access-Control-Allow-Origin' '*' always;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
- add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
- }
- if ($request_method = 'GET') {
- add_header 'Access-Control-Allow-Origin' '*' always;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
- add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
- }
- rewrite ^/(.*)$ /$1 break;
- proxy_pass http://127.0.0.1:61337/api;
- }
- 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;
- }
- root /var/www/edu-textbook/;
- location /{
- try_files $uri $uri/ /index.html?$query_string;
- }
- }
|