安裝包下載
https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe
docker應用管理工具,選擇性安裝
https://www.rainbond.com/docs/quick-start/quick-install
https://www.bilibili.com/video/BV1MZ4y1b7wW/?p=2&spm_id_from=pageDriver&vd_source=b44203991b8ee2e43d764088707392f5
解決“無法載入檔案 ***\WindowsPowerShell\profile.ps1,因為在此係統上禁止執行指令碼”
Rabbitmq 安裝命令
docker run -d --hostname rabbitmq --name rabbitmq -p 15672:15672 -p 5672:5672 rabbitmq:latest
docker exec -it rabbitmq /bin/bash -c "rabbitmq-plugins enable rabbitmq_management"
1. 執行RabbitMQ容器
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
2. 進入RabbitMQ容器
docker exec -it rabbitmq bash
3. 使用rabbitmqctl命令建立使用者
rabbitmqctl add_user yaya yaya
rabbitmqctl set_user_tags yaya administrator
rabbitmqctl set_permissions -p / yaya ".*" ".*" ".*"
REDIS
docker run -d --name myredis -p 6379:6379 redis --requirepass "123456"
Nginx etc/nginx/conf.d/default.conf, etc/nginx/nginx.conf
server { listen 20005; server_name localhost; client_max_body_size 100M; set $cache max-age=86400; location / { root /usr/share/nginx/html; #解決頁面重新整理404問題 try_files $uri $uri/ @router; index index.html index.htm; add_header Access-Control-Allow-Origin *; add_header Cache-Control $cache; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; if ($request_method = 'OPTIONS') { return 204; } } # 由於路由的資源不一定是真實的路徑,無法找到具體檔案 # 所以需要將請求重寫到 index.html 中,然後交給真正的 Vue 路由處理請求資源 location @router { add_header Cache-Control $cache; rewrite ^.*$ /index.html last; } # 關鍵步驟,這裡表示將所有的 http://172.18.1.82:80/api/ 開頭的請求都轉發到下面 proxy_pass 指定的連結中 # 為了防止在訪問頁面時請求就被 Nginx 代理轉發,這裡需要更具體的配置,才能和前端訪問請求區分開 location /api/ { # 後端的真實介面 proxy_pass http://localhost:8000/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Cookie $http_cookie; # for Ajax #fastcgi_param HTTP_X_REQUESTED_WITH $http_x_requested_with; proxy_set_header HTTP-X-REQUESTED-WITH $http_x_requested_with; proxy_set_header HTTP_X_REQUESTED_WITH $http_x_requested_with; proxy_set_header x-requested-with $http_x_requested_with; client_max_body_size 100m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 128k; proxy_buffers 32 32k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k; } } user nginx; worker_processes auto; 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; # 開啟和關閉gzip模式 gzip on; # gizp壓縮起點,檔案大於1k才進行壓縮 gzip_min_length 1k; # 設定壓縮所需要的緩衝區大小,以4k為單位,如果檔案為7k則申請2*4k的緩衝區 gzip_buffers 4 16k; # 設定gzip壓縮針對的HTTP協議版本 gzip_http_version 1.0; # gzip 壓縮級別,1-9,數字越大壓縮的越好,也越佔用CPU時間 gzip_comp_level 5; # 進行壓縮的檔案型別 gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x -httpd-php application/javascript application/json; # 是否在http header中新增Vary: Accept-Encoding,建議開啟 gzip_vary on; include /etc/nginx/conf.d/*.conf; }
拉去前端檔案放Nginx裡面
源:/root/home/web
目的:C:\Users\admin\Desktop\yaya_nginx\web
各個資料夾dist解壓到dist:比如
C:\Users\admin\Desktop\yaya_nginx\nginx\nginx-erp\dist.zip 壓縮檔案
C:\Users\admin\Desktop\yaya_nginx\nginx\nginx-erp\dist 資料夾
NGINX批次啟動指令碼和停止
@echo off
set nginx_path=C:\Users\admin\Desktop\yaya_nginx\nginx
cd "%nginx_path%\nginx-scm
start "nginx" "%nginx_path%\nginx-scm\nginx.exe"
cd ../nginx-ums
start "nginx" "%nginx_path%\nginx-ums\nginx.exe"
cd ../nginx-erp
start "nginx" "%nginx_path%\nginx-erp\nginx.exe"
cd ../nginx-mes
start "nginx" "%nginx_path%\nginx-mes\nginx.exe"
cd ../nginx-plm
start "nginx" "%nginx_path%\nginx-plm\nginx.exe"
timeout 10
@echo off
taskkill /f /im nginx.exe
exit