This commit is contained in:
xxx
2024-06-05 17:24:49 +08:00
parent f5047edd91
commit 37fccc1f40
9 changed files with 1750 additions and 17 deletions

18
docker/mysql/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM mysql:8.1
# 时区配置
ARG TZ=UTC
ENV TZ ${TIMEZONE}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone && chown -R mysql:root /var/lib/mysql/
# 复制自定义的my.cnf
COPY my.cnf /etc/mysql/conf.d/my.cnf
# my.cnf只读权限
RUN chmod 0444 /etc/mysql/conf.d/my.cnf
# 暴露3306端口
EXPOSE 3306
# 启动mysql
CMD ["mysqld"]

12
docker/mysql/my.cnf Normal file
View File

@@ -0,0 +1,12 @@
# The MySQL Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]
default-character-set=utf8mb4
[mysqld]
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
character-set-server=utf8mb4
default-authentication-plugin=mysql_native_password

View File

@@ -0,0 +1,131 @@
client_max_body_size 50m;
server {
# 监听端口号9800
listen 9800;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/pc;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号9801
listen 9801;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/h5;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号9900
listen 9900;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/admin;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号80
listen 9700;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/pc;
# 指定默认的索引文件为index.html
index index.html;
# 将所有请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
}

9
docker/redis/Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM redis:7.0.12
COPY redis.conf /usr/local/etc/redis/redis.conf
VOLUME /data
EXPOSE 6379
CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]

1377
docker/redis/redis.conf Normal file

File diff suppressed because it is too large Load Diff