dev01 1 年之前
父节点
当前提交
415dec003a
共有 4 个文件被更改,包括 63 次插入2 次删除
  1. 7 0
      Dockerfile
  2. 2 2
      config/dev.js
  3. 23 0
      nginx/conf.d/default.conf
  4. 31 0
      nginx/nginx.conf

+ 7 - 0
Dockerfile

@@ -0,0 +1,7 @@
+FROM nginx:alpine
+WORKDIR /app
+COPY dist /app
+COPY nginx/nginx.conf /etc/nginx/
+COPY nginx/conf.d/default.conf /etc/nginx/conf.d
+
+EXPOSE 8080

+ 2 - 2
config/dev.js

@@ -35,8 +35,8 @@ module.exports = {
           changeOrigin: true
         }
       },
-      // host: "172.16.1.187",
-      // port: 8080,
+      host: "172.16.1.187",
+      port: 8080,
     }
   }
 }

+ 23 - 0
nginx/conf.d/default.conf

@@ -0,0 +1,23 @@
+server {
+        listen       8080;
+        server_name  _;
+        charset utf-8;
+        location / {
+            root   /app;
+            try_files $uri $uri/ /index.html;
+            index  index.html index.htm;
+        }
+
+        location /gw/ {
+            proxy_set_header Host $http_host;
+            proxy_set_header X-Real-IP $remote_addr;
+            proxy_set_header REMOTE-HOST $remote_addr;
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_pass http://127.0.0.1:8880;
+        }
+
+        error_page   500 502 503 504  /50x.html;
+        location = /50x.html {
+            root   html;
+        }
+    }

+ 31 - 0
nginx/nginx.conf

@@ -0,0 +1,31 @@
+user  nginx;
+worker_processes  2;
+
+error_log  /var/log/nginx/error.log notice;
+pid        /var/run/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       /etc/nginx/mime.types;
+    default_type  application/octet-stream;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    keepalive_timeout  65;
+
+    gzip  on;
+
+    include /etc/nginx/conf.d/*.conf;
+}