ClearLove443 commited on
Commit
23c5b0c
·
1 Parent(s): 6d22939
Files changed (3) hide show
  1. Dockerfile +9 -0
  2. app.conf +30 -0
  3. dist/index.html +23 -0
Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM nginx:latest
2
+
3
+ ## 镜像工作目录
4
+ RUN echo 1: $PWD
5
+ WORKDIR /tmp/front_work_dir
6
+ RUN echo 2: $PWD
7
+ COPY ./dist ./
8
+
9
+ COPY app.conf /etc/nginx/conf.d
app.conf ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #front-end
3
+ server {
4
+ listen 8000;
5
+ server_name localhost;
6
+ location / {
7
+ root /tmp/front_work_dir;
8
+ index index.html index.htm;
9
+ }
10
+ #error_page 404 /404.html;
11
+ }
12
+
13
+ # 反向代理 front-end 和 back-end
14
+ server {
15
+ listen 80;
16
+ listen [::]:80;
17
+ server_name onlyyounotothers.top www.onlyyounotothers.top;
18
+ # http 重定向到 https
19
+ return 301 https://onlyyounotothers.top$request_uri;
20
+ location / {
21
+ root html;
22
+ index index.html index.htm;
23
+ proxy_pass http://localhost:8000/;
24
+ }
25
+ location /api/ {
26
+ rewrite ^/b/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
27
+ proxy_pass http://110.40.137.191:3000/;
28
+ }
29
+ }
30
+
dist/index.html ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Welcome to nginx!</title>
5
+ <style>
6
+ html { color-scheme: light dark; }
7
+ body { width: 35em; margin: 0 auto;
8
+ font-family: Tahoma, Verdana, Arial, sans-serif; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <h1>Welcome to nginx!</h1>
13
+ <p>If you see this page, the nginx web server is successfully installed and
14
+ working. Further configuration is required.</p>
15
+
16
+ <p>For online documentation and support please refer to
17
+ <a href="http://nginx.org/">nginx.org</a>.<br/>
18
+ Commercial support is available at
19
+ <a href="http://nginx.com/">nginx.com</a>.</p>
20
+
21
+ <p><em>Thank you for using nginx.</em></p>
22
+ </body>
23
+ </html>