端口修改

This commit is contained in:
none 2023-05-30 11:50:27 +08:00
parent d861eaf710
commit 13c58500c1
2 changed files with 32 additions and 13 deletions

View File

@ -17,7 +17,7 @@ docker build -t playedu-light .
执行完毕之后,可运行下面命令将 PlayEdu 服务跑起来: 执行完毕之后,可运行下面命令将 PlayEdu 服务跑起来:
``` ```
docker run -d -p 9898:80 --name playedu-local \ docker run -d -p 9800:9800 -p 9900:9900 --name playedu-local \
-e DB_HOST=数据库host \ -e DB_HOST=数据库host \
-e DB_PORT=数据库端口 \ -e DB_PORT=数据库端口 \
-e DB_NAME=数据库名 \ -e DB_NAME=数据库名 \
@ -37,7 +37,6 @@ docker run -d -p 9898:80 --name playedu-local \
跑起来之后,可以通过下面的链接访问前后台: 跑起来之后,可以通过下面的链接访问前后台:
| 端口 | 地址 | | 端口 | 地址 |
| -------- | ----------------------------- | | -------- | ----------------------- |
| 学员界面 | `http://localhost:9898` | | 学员界面 | `http://localhost:9800` |
| 后台管理 | `http://localhost:9898/admin` | | 后台管理 | `http://localhost:9900` |
| API 服务 | `http://localhost:9898/api` |

View File

@ -1,5 +1,5 @@
server { server {
listen 80 default_server; listen 9800 default_server;
absolute_redirect off; absolute_redirect off;
server_name _; server_name _;
@ -24,11 +24,25 @@ server {
proxy_pass http://127.0.0.1:9898/; proxy_pass http://127.0.0.1:9898/;
} }
location /admin { location ~ /\.ht {
alias /app/backend; deny all;
}
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
listen 9900 default_server;
absolute_redirect off;
server_name _;
root /app/backend;
index index.html; index index.html;
try_files $uri $uri/ /admin/index.html; location / {
try_files $uri $uri/ /index.html;
gzip on; gzip on;
gzip_static on; gzip_static on;
@ -39,11 +53,17 @@ server {
gzip_vary on; gzip_vary on;
} }
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/;
}
location ~ /\.ht { location ~ /\.ht {
deny all; deny all;
} }
location ~* ^/(?![api|admin].*) { location ~* ^/(?![api].*) {
try_files $uri /index.html; try_files $uri /index.html;
} }
} }