Compare commits
10 Commits
b40bc183d0
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c0810e4352 | ||
![]() |
53668b12e9 | ||
![]() |
e6f36da184 | ||
![]() |
22ed9ab4d7 | ||
![]() |
37b43ef8f5 | ||
![]() |
5421b81828 | ||
![]() |
1021a2d6be | ||
![]() |
20283e17b9 | ||
![]() |
1abc63a603 | ||
![]() |
539c9c7453 |
@@ -25,11 +25,9 @@ services:
|
||||
- app-network
|
||||
|
||||
nginx:
|
||||
image: nginx:stable-alpine
|
||||
build: ./nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
depends_on:
|
||||
- frontend
|
||||
- backend
|
||||
|
@@ -23,6 +23,9 @@ FROM nginx:stable-alpine as production-stage
|
||||
# 复制构建好的文件到Nginx目录
|
||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||
|
||||
# 复制Nginx配置文件
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 暴露80端口
|
||||
EXPOSE 80
|
||||
|
||||
|
21
frontend/nginx.conf
Normal file
21
frontend/nginx.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
# 用户连接数
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
# 设置根目录
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 处理SPA路由
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
}
|
@@ -82,6 +82,9 @@ const handleConfirm = async () => {
|
||||
if (!createData.password) {
|
||||
throw new Error('密码不能为空')
|
||||
}
|
||||
if (!/^\d{6,}$/.test(createData.password)) {
|
||||
throw new Error('密码必须为6位或以上的数字')
|
||||
}
|
||||
await userService.createUser({
|
||||
username: createData.username,
|
||||
password: createData.password,
|
||||
|
11
nginx/Dockerfile
Normal file
11
nginx/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
# 使用Nginx作为基础镜像
|
||||
FROM nginx:stable-alpine
|
||||
|
||||
# 复制Nginx配置文件
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 暴露80端口
|
||||
EXPOSE 80
|
||||
|
||||
# 启动Nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
Reference in New Issue
Block a user