Browse Source

update docker

fish 1 year ago
parent
commit
b9b5590df9
3 changed files with 112 additions and 68 deletions
  1. 64 44
      deploy/docker-compose.debug.yml
  2. 24 0
      deploy/mysql/my.cnf
  3. 24 24
      deploy/nginx/vhost.conf

+ 64 - 44
deploy/docker-compose.debug.yml

@@ -17,57 +17,77 @@ services:
   #     - mysql
   #     # - redis
 
-  # nginx:
-  #   container_name: survey-nginx
-  #   image: nginx:alpine
-  #   restart: always
-  #   ports:
-  #     - 8011:80
-  #   # depends_on:
-  #   #   - phpfpm
-  #   environment:
-  #     - TZ=Asia/Shanghai
-  #   working_dir: /var/www
-  #   # volumes_from:
-  #   #   - phpfpm
-  #   volumes:
-  #     - ./nginx/vhost.conf:/etc/nginx/conf.d/default.conf
-  #     - ./nginx/log:/etc/nginx/log
-  #   networks:
-  #     - survey_net:
-  #       ipv4_address: 192.168.10.80
-
-  mysql:
-    image: mysql:5.7
-    environment:
-      MYSQL_ROOT_PASSWORD: root
-      MYSQL_DATABASE: test
-      MYSQL_USER: root
-      MYSQL_PASSWORD: root
+  nginx:
+    container_name: survey_nginx
+    image: nginx:alpine
+    restart: always
     ports:
-      - 3306:3306
-    # volumes:
-    #   - mysql:/var/lib/mysql
-    # networks:
-    #   - survey_net
+      - 8081:80
+    # depends_on:
+    #   - phpfpm
+    environment:
+      - TZ=Asia/Shanghai
+    working_dir: /var/www
+    # volumes_from:
+    #   - phpfpm
+    volumes:
+      - ./nginx/vhost.conf:/etc/nginx/conf.d/default.conf
+      - ./nginx/log:/etc/nginx/log
+      - ./../web:/var/www/public
+    networks:
+        survey_net:
+          ipv4_address: 192.168.10.80
 
-  # redis:
-  #   image: redis:latest
+  # mysql:
+  #   container_name: survey_mysql
+  #   image: mysql:5.7
+  #   environment:
+  #     MYSQL_ROOT_PASSWORD: root
+  #     MYSQL_DATABASE: test
+  #     MYSQL_USER: lyq
+  #     MYSQL_PASSWORD: 123456
   #   ports:
-  #     - 6379:6379
+  #     - 3306:3306
   #   volumes:
-  #     - redis:/data
+  #     # - mysql:/var/lib/mysql
+  #     - ./mysql/my.cnf:/etc/mysql/my.cnf
+  #     - ./mysql/data:/var/lib/mysql
+  #     - ./mysql/log:/var/log/mysql
+  #   # privileged: true
+  #   command:
+  #      --character-set-server=utf8mb4
+  #      --collation-server=utf8mb4_general_ci
+  #      --explicit_defaults_for_timestamp=true
+  #      --lower_case_table_names=1
+  #      --max_allowed_packet=128M
+  #      --default-authentication-plugin=mysql_native_password
+  #      --sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
+  #   working_dir: /var/lib/mysql
   #   networks:
-  #     - survey_net
+  #     survey_net:
+  #         ipv4_address: 192.168.10.81
+
+    # redis:
+    #   image: redis:latest
+    #   ports:
+    #     - 6379:6379
+    #   volumes:
+    #     - redis:/data
+    #   networks:
+    #     - survey_net
 
-# networks:
-#   survey_net:
-#     driver: bridge
+networks:
+  survey_net:
+    driver: bridge
+    ipam: #网络配置
+      config:
+        - subnet: 192.168.0.0/16 #IP区间
+          gateway: 192.168.10.100
 
-# volumes:
-#   mysql:
-#     external:
-#       name: mysql
+  # volumes:
+  #   mysql:
+  #     external:
+  #       name: mysql
   # redis:
   #   external:
   #     name: redis

+ 24 - 0
deploy/mysql/my.cnf

@@ -0,0 +1,24 @@
+[client]
+port		= 3306
+socket		= /var/run/mysqld/mysqld.sock
+[mysqld_safe]
+pid-file	= /var/run/mysqld/mysqld.pid
+nice		= 0
+
+[mysqld]
+user		= mysql
+basedir		= /usr
+datadir		= /var/lib/mysql
+tmpdir		= /tmp
+lc-messages-dir	= /usr/share/mysql
+explicit_defaults_for_timestamp
+skip-grant-tables
+lower_case_table_names = 1
+character-set-server = utf8mb4
+collation-server = utf8mb4_unicode_ci
+sql-mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+#bind-address	= 127.0.0.1
+log-error	= /var/log/mysql/error.log
+sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
+symbolic-links=0
+!includedir /etc/mysql/conf.d/

+ 24 - 24
deploy/nginx/vhost.conf

@@ -26,33 +26,33 @@ server {
         error_log off;
         access_log /dev/null; 
     }
-    location /notice {
-        proxy_pass http://192.168.10.90:20002;  
-        proxy_http_version 1.1;
-        proxy_set_header Upgrade $http_upgrade;
-        proxy_set_header Connection "upgrade";
-        proxy_set_header X-real-ip $remote_addr;
-        proxy_set_header X-Forwarded-For $remote_addr;
-    }
-    location /msg {
-        proxy_pass http://192.168.10.90:20003/;  
-        proxy_http_version 1.1;
-        proxy_set_header Upgrade $http_upgrade;
-        proxy_set_header Connection "upgrade";
-        proxy_set_header X-real-ip $remote_addr;
-        proxy_set_header X-Forwarded-For $remote_addr;
-    }
+    # location /notice {
+    #     proxy_pass http://192.168.10.90:20002;  
+    #     proxy_http_version 1.1;
+    #     proxy_set_header Upgrade $http_upgrade;
+    #     proxy_set_header Connection "upgrade";
+    #     proxy_set_header X-real-ip $remote_addr;
+    #     proxy_set_header X-Forwarded-For $remote_addr;
+    # }
+    # location /msg {
+    #     proxy_pass http://192.168.10.90:20003/;  
+    #     proxy_http_version 1.1;
+    #     proxy_set_header Upgrade $http_upgrade;
+    #     proxy_set_header Connection "upgrade";
+    #     proxy_set_header X-real-ip $remote_addr;
+    #     proxy_set_header X-Forwarded-For $remote_addr;
+    # }
     
    
 
-    location ~ \.php$ {
-        fastcgi_split_path_info ^(.+\.php)(/.+)$;
-        fastcgi_pass phpfpm:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-        fastcgi_param PATH_INFO $fastcgi_path_info;
-    }
+    # location ~ \.php$ {
+    #     fastcgi_split_path_info ^(.+\.php)(/.+)$;
+    #     fastcgi_pass phpfpm:9000;
+    #     fastcgi_index index.php;
+    #     include fastcgi_params;
+    #     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+    #     fastcgi_param PATH_INFO $fastcgi_path_info;
+    # }
     
    
 }