Kaynağa Gözat

测试nginx

龚成明 2 yıl önce
ebeveyn
işleme
b06a71cf03
5 değiştirilmiş dosya ile 171 ekleme ve 22 silme
  1. 121 0
      .dockerignore
  2. 0 3
      .gitignore
  3. 8 0
      Dockerfile
  4. 42 0
      nginx.conf
  5. 0 19
      upload

+ 121 - 0
.dockerignore

@@ -0,0 +1,121 @@
+### Node template
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+*.lcov
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# Snowpack dependency directory (https://snowpack.dev/)
+web_modules/
+
+# TypeScript cache
+*.tsbuildinfo
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Microbundle cache
+.rpt2_cache/
+.rts2_cache_cjs/
+.rts2_cache_es/
+.rts2_cache_umd/
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+.parcel-cache
+
+# Next.js build output
+.next
+out
+
+# Nuxt.js build / generate output
+.nuxt
+dist
+
+# Gatsby files
+.cache/
+# Comment in the public line in if your project uses Gatsby and not Next.js
+# https://nextjs.org/blog/next-9-1#public-directory-support
+# public
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+# TernJS port file
+.tern-port
+
+# Stores VSCode versions used for testing VSCode extensions
+.vscode-test
+
+# yarn v2
+.yarn/cache
+.yarn/unplugged
+.yarn/build-state.yml
+.yarn/install-state.gz
+.pnp.*
+
+#idea
+.idea
+

+ 0 - 3
.gitignore

@@ -1,6 +1,4 @@
 .DS_Store
-nginx.conf
-server.xml
 /node_modules
 /dist
 
@@ -25,4 +23,3 @@ yarn.lock
 *.sln
 *.sw?
 
-*.pem

+ 8 - 0
Dockerfile

@@ -0,0 +1,8 @@
+FROM node:16 as node
+COPY . /app
+WORKDIR /app
+RUN npm install
+RUN npm run build
+FROM nginx:1.22 as nginx
+COPY --from=node /app/dist /app
+COPY --from=node /app/nginx.conf /etc/nginx/nginx.conf

+ 42 - 0
nginx.conf

@@ -0,0 +1,42 @@
+user root;
+
+events {
+    worker_connections 51200;
+}
+
+http {
+    access_log /app/access.log;
+    error_log /app/error.log;
+
+    gzip on;
+    gzip_min_length 1k;
+    gzip_buffers 4 16k;
+    gzip_http_version 1.1;
+    gzip_comp_level 9;
+    gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
+    gzip_disable "MSIE [1-6]\.";
+    include mime.types;
+    default_type application/octet-stream;
+    sendfile on;
+    keepalive_timeout 65;
+    client_header_timeout 150;
+    client_body_timeout 1800;
+    send_timeout 150;
+
+    server {
+        listen       80;
+        server_name  127.0.0.1;
+
+        location  / {
+            index  index.html index.htm;
+            try_files $uri $uri/ /index.html;
+            root /app;
+        }
+
+        location /api/ {
+            proxy_pass http://web.410eth.com:8888/;
+            add_header 'Access-Control-Allow-Origin' '*';
+            add_header 'Access-Control-Allow-Credentials' 'true';
+        }
+    }
+}

+ 0 - 19
upload

@@ -1,19 +0,0 @@
-sudo scp -i ~/Desktop/no1.pem -r /Volumes/Code/Customer/410/ethereum_viewer_webapp/dist ec2-user@3.227.34.41:/webapp/frontend
-sudo scp -i 410.pem -r /Volumes/Code/Customer/410/ethereum_viewer_webapp/dist ec2-user@3.227.34.41:/webapp/frontend-blockchain
-scp -i 410.pem -r C:/Users/skyfffire/WebstormProjects/ethereum_viewer_webapp/dist ec2-user@3.227.34.41:/webapp/frontend-blockchain
-scp -i 410.pem /Volumes/Code/Customer/410/ethereum_viewer_webapp/nginx.conf ec2-user@3.227.34.41:/etc/nginx
-scp -i 410.pem C:/Users/skyfffire/WebstormProjects/ethereum_viewer_webapp/nginx.conf ec2-user@3.227.34.41:/etc/nginx
-
-start:
-systemctl start nginx
-restart:
-systemctl restart nginx
-status:
-systemctl status nginx
-stop:
-systemctl stop nginx
-
-logs:
-tail -f /eth_node/web/webapps/access.log
-tail -f /eth_node/web/webapps/error.log
-cat /eth_node/web/webapps/error.log