Browse Source

feat: docker only backend

ryanemax 9 tháng trước cách đây
mục cha
commit
c388859e39
3 tập tin đã thay đổi với 21 bổ sung43 xóa
  1. 12 0
      README.md
  2. 0 10
      docker/Dockerfile
  3. 9 33
      server/config/nginx-server.conf

+ 12 - 0
README.md

@@ -105,6 +105,18 @@ https://api-explorer.authing.cn/?source=Authing%20%E7%94%A8%E6%88%B7%E8%AE%A4%E8
 
 测试用户池密钥:491670e7ef2fd553ce6d0668a1bb87f3
 
+
+# 开发人员协作
+- 高教社运维负责
+    - 4966367 wuhuaide 1649663385 
+    - 吴怀德  
+    - wuhuaide (867947897@qq.com)
+- Authing项目负责
+    - 韩磊-leohan83
+    - 韩磊   我自己
+    - leohan83 (hanlei@authing.com)
+
+
 # 国家级教材遴选系统——前端项目 edu-textbook
 
 This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.4.

+ 0 - 10
docker/Dockerfile

@@ -1,15 +1,6 @@
 FROM debian:bullseye-slim
 MAINTAINER FmodeInc "support@fmode.cn"
 
-ARG NODE_VERSION
-ARG TERM
-ARG NGINX_DISABLE
-######################################## ENV LIST
-ENV NODE_VERSION $NODE_VERSION
-ENV TERM $TERM
-ENV NGINX_DISABLE $NGINX_DISABLE
-
-
 ######################################## APT Repos to 163
 # RUN apt-get update
 
@@ -54,7 +45,6 @@ RUN apt-get update &&apt-get install -y nginx procps && apt-get install -y nginx
 ######################################## Copy Latest System
 COPY ./opt/ /opt/
 
-RUN mkdir -p /var/www/edu-textbook/ && cd /var/www/ && mv /opt/edu-textbook-www.tar.gz . && tar zxvf edu-textbook-www.tar.gz && cp -rf dist/textbook/browser/* edu-textbook/
 RUN mkdir -p /opt/edu-textbook-server/ && cd /opt/ && tar zxvf server.tar.gz && mv server/* edu-textbook-server/ && mkdir -p /etc/nginx/sites-enabled/ && cp -rf /opt/edu-textbook-server/config/nginx-server.conf /etc/nginx/sites-enabled/ && service nginx restart
 
 RUN ls /opt/ && chown -R root:root /opt/*

+ 9 - 33
server/config/nginx-server.conf

@@ -13,39 +13,6 @@ server {
 	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';
-            #
-            # Custom headers and headers various browsers *should* be OK with but aren't
-            #
-            add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
-            #
-            # Tell client that this pre-flight info is valid for 20 days
-            #
-            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;
@@ -56,6 +23,15 @@ server {
         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 /{