Browse Source

nginx添加

anderx 1 year ago
parent
commit
7864753ee6
3 changed files with 49 additions and 0 deletions
  1. 7 0
      Dockerfile
  2. 11 0
      nginx/conf.d/default.conf
  3. 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

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

@@ -0,0 +1,11 @@
+server {
+    listen       8080;
+    listen  [::]:8080;
+    server_name  _;
+
+    location / {
+        root   /app;
+        index  index.html index.htm;
+        try_files $uri $uri/ /index.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;
+}