Browse Source

fix(nginx-web-edit错误): 🐛 修复web-edit无法访问的问题

zgx
愿您有个好心情 2 years ago
parent
commit
610ab6d7bb
  1. 31
      README.md
  2. 32
      area-security-web/conf.d/default.conf
  3. 3
      docker-compose.yml
  4. 1
      service/Dockerfile
  5. 18
      web/conf.d/default.conf

31
README.md

File diff suppressed because one or more lines are too long

32
area-security-web/conf.d/default.conf

@ -2,11 +2,14 @@ server {
listen 3000;
listen [::]:3000;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
#charset koi8-r;
#access_log logs/host.access.log main;
#解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri @rewrites;
# 开启缓存
location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
access_log off;
@ -24,6 +27,31 @@ server {
expires max;
}
}
location /edit {
try_files $uri $uri @rewrites;
# 开启缓存
location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
access_log off;
expires 2d;
}
location ~* ^.+\.(css|js|txt|xml|swf|wav)$ {
access_log off;
expires 24h;
}
location ~* ^.+\.(html|htm)$ {
expires 1h;
}
location ~* ^.+\.(eot|ttf|otf|woff|svg)$ {
access_log off;
expires max;
}
}
location @rewrites {
rewrite ^(.+)$ /index.html?s=$1 last;
}
# 后台服务配置,配置了这个location便可以通过访问
location ^~ /military {
proxy_pass http://military-system:8049/military/;

3
docker-compose.yml

@ -6,6 +6,9 @@ services:
image: military_zgx_system
container_name: military_zgx_system
restart: on-failure
# 要映射出来的路径
# /data 为以前的opt路径
# application-prod.yml 配置文件
# volumes:
# - E:\opt:/data:rw
# - D:\deploy\application-prod.yml:/military/config/application-prod.yml:ro

1
service/Dockerfile

@ -18,7 +18,6 @@ ENV JAVA_OPTS=$JAVA_OPTS
# 从当前工作目录复制文件到镜像目录中并重新命名
COPY config /military/config
COPY data /data
COPY military.jar /military/military.jar
# 执行Linux命令,运行jar包

18
web/conf.d/default.conf

@ -12,6 +12,9 @@ server {
listen [::]:3001;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
# 后台服务配置,配置了这个location便可以通过访问
location ^~ /military {
proxy_pass http://back_end/military/;
@ -35,11 +38,14 @@ server {
#解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题
location / {
root /usr/share/nginx/html;
index index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.html?s=$1 last;
break;
}
try_files $uri $uri @rewrites;
}
location /edit {
try_files $uri $uri @rewrites;
}
location @rewrites {
rewrite ^(.+)$ /index.html?s=$1 last;
}
}
Loading…
Cancel
Save