main
黄海 10 months ago
parent 3caed09307
commit 0283f0ed0b

@ -1,13 +0,0 @@
FROM openresty/openresty:1.21.4.1-0-alpine AS runner
# ENV TZ这样的用法通常是用来设置时区环境变量TZ代表Time Zone
ENV TZ=Asia/Shanghai
# 将本地的Nginx配置文件复制到镜像中的指定路径
COPY ./nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
# 将本地的静态资源文件复制到镜像中的指定路径
COPY /static /usr/local/openresty/nginx/html
# 暴露Nginx服务的端口
EXPOSE 80

@ -1,29 +0,0 @@
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
client_max_body_size 100M; # 允许上传的最大文件大小为100MB
keepalive_timeout 65;
server {
listen 80;
server_name ds-exam;
location / {
root html;
index index.html index.htm;
}
location /base {
proxy_pass http://127.0.0.1:9001/base;
}
}
}

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>dsExam</title>
</head>
<body>
Welcome to dsExam.
</body>
</html>

@ -1,21 +0,0 @@
### 思路
以OpenResty做为网关不使用JAVA系的方法构建网关
原因:
1、OpenResty更快性能更好
2、OpenResty更灵活更熟悉
3、网关主要有两个职能是我关心的一个是路由另一个是鉴权
路由无疑Nginx是无敌的而鉴权我不想依赖于OpenResty,而且使用JAVA来让每个微服务模块
来自行实现,各回各家,各找各妈,不把鉴权任务交给网关。
### 下载地址
https://openresty.org/cn/download.html
### Docker 镜像
https://hub.docker.com/r/openresty/openresty
```shell
docker run -p 80:80 -d openresty/openresty:1.21.4.1-0-alpine
```
我采用的镜像是1.21.4.1-0-alpine这个版本的底包较小适合在容器中使用。
需要使用Dockerfile来创建我的网关镜像采用配置好的nginx.conf拷贝进镜像中
并修改nginx.conf使其符合我的需求。
Loading…
Cancel
Save