mirror of
https://github.com/PlayEdu/docker-playedu-light
synced 2025-06-07 05:15:40 +08:00
v1.0-beta7
This commit is contained in:
parent
245eb95da9
commit
250889992b
@ -51,6 +51,7 @@ docker run -d -p 9800:9800 -p 9900:9900 --name playedu-local \
|
||||
-e REDIS_HOST=Redis的host \
|
||||
-e REDIS_PORT=Redis的端口 \
|
||||
-e REDIS_PASS=redis的密码 \
|
||||
-e SA_TOKEN_JWT_SECRET_KEY=随机英文+数字的字符串 \
|
||||
playedu-light
|
||||
```
|
||||
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
nginx
|
||||
|
||||
java -jar /app/api/app.jar --spring.profiles.active=prod --spring.datasource.url="jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false" --spring.datasource.username=${DB_USER} --spring.datasource.password=${DB_PASS} --spring.data.redis.host=${REDIS_HOST} --spring.data.redis.port=${REDIS_PORT} --spring.data.redis.password=${REDIS_PASS}
|
||||
java -jar /app/api/app.jar --spring.profiles.active=prod --spring.datasource.url="jdbc:mysql://${DB_HOST}:${DB_PORT:-3306}/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false" --spring.datasource.username=${DB_USER} --spring.datasource.password=${DB_PASS} --spring.data.redis.host=${REDIS_HOST} --spring.data.redis.port=${REDIS_PORT} --spring.data.redis.password=${REDIS_PASS} --spring.data.redis.database=${REDIS_DB:-0} --sa-token.is-concurrent=${SA_TOKEN_IS_CONCURRENT:-false} --sa-token.jwt-secret-key=${SA_TOKEN_JWT_SECRET_KEY:-playeduxyz}
|
@ -1,69 +1,102 @@
|
||||
server {
|
||||
# 监听端口号9800
|
||||
listen 9800 default_server;
|
||||
# 禁用绝对重定向
|
||||
# 如果没有设置该配置项,当Nginx重定向时,它将使用绝对路径,这意味着当用户访问一个虚拟主机时
|
||||
# Nginx可能会将他们重定向到另一个主机的URL,这可能会导致安全问题和用户体验问题。因此,通过
|
||||
# 设置 absolute_redirect off ,Nginx将使用相对路径进行重定向,以确保用户在同一主机上进
|
||||
# 行重定向,而不会遇到上述问题。
|
||||
absolute_redirect off;
|
||||
# 匹配任何主机名
|
||||
server_name _;
|
||||
|
||||
# 指定Web应用程序的根目录
|
||||
root /app/frontend;
|
||||
# 指定默认的索引文件为index.html
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
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;
|
||||
}
|
||||
# 启用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/;
|
||||
}
|
||||
|
||||
# 拒绝所有以.ht开头的请求
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# 处理所有不以/api/开头的请求,尝试查找匹配的文件,如果没有找到则返回index.html
|
||||
location ~* ^/(?![api].*) {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
# 监听端口号9900
|
||||
listen 9900 default_server;
|
||||
# 禁用绝对重定向
|
||||
# 如果没有设置该配置项,当Nginx重定向时,它将使用绝对路径,这意味着当用户访问一个虚拟主机时
|
||||
# Nginx可能会将他们重定向到另一个主机的URL,这可能会导致安全问题和用户体验问题。因此,通过
|
||||
# 设置 absolute_redirect off ,Nginx将使用相对路径进行重定向,以确保用户在同一主机上进
|
||||
# 行重定向,而不会遇到上述问题。
|
||||
absolute_redirect off;
|
||||
# 匹配任何主机名
|
||||
server_name _;
|
||||
|
||||
# 指定Web应用程序的根目录
|
||||
root /app/backend;
|
||||
# 指定默认的索引文件为index.html
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
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;
|
||||
}
|
||||
# 启用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/;
|
||||
}
|
||||
|
||||
# 拒绝所有以.ht开头的请求
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# 处理所有不以/api/开头的请求,尝试查找匹配的文件,如果没有找到则返回index.html
|
||||
location ~* ^/(?![api].*) {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
# 监听端口号80
|
||||
listen 80 default_server;
|
||||
# 匹配任何主机名
|
||||
server_name _;
|
||||
# 指定Web应用程序的根目录
|
||||
root /app/api;
|
||||
# 指定默认的索引文件为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/;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user