瀏覽代碼

nginx添加

anderx 11 月之前
父節點
當前提交
7864753ee6
共有 3 個文件被更改,包括 49 次插入0 次删除
  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;
+}