Skip to content

Commit

Permalink
feat/添加Nginx承载目录
Browse files Browse the repository at this point in the history
  • Loading branch information
freestylefly committed May 27, 2024
1 parent 6bce40c commit 4717b2f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docker/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

server {
listen 80;
server_name localhost;

location / {
root /home/ruoyi/projects/ruoyi-ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}

location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://ruoyi-gateway:8080/;
}

# 避免actuator暴露
if ($request_uri ~ "/actuator") {
return 403;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
15 changes: 15 additions & 0 deletions docker/nginx/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 基础镜像
FROM nginx
# author
MAINTAINER canghe

# 挂载目录
VOLUME /home/pmhub/projects/pmhub-ui
# 创建目录
RUN mkdir -p /home/pmhub/projects/pmhub-ui
# 指定路径
WORKDIR /home/pmhub/projects/pmhub-ui
# 复制conf文件到路径
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
# 复制html文件到路径
COPY ./html/dist /home/pmhub/projects/pmhub-ui
1 change: 1 addition & 0 deletions docker/nginx/html/dist/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���ǰ��pmhub-ui�����õľ�̬�ļ�������nginx������ʡ�

0 comments on commit 4717b2f

Please sign in to comment.