Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nginx proxy jvue-server #37

Merged
merged 2 commits into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# 构建docker-compose项目
# docker-compose up
# docker-compose up -V --force-recreate
# docker-compose up -d --force-recreate
version: '3'
services:
mysql:
jvue-nginx:
privileged: true
image: jvue/nginx:1.15.9
container_name: jvue-nginx
build:
context: ./
dockerfile: ./jvue-nginx/Dockerfile
ports:
- "80:80"
volumes:
- ./jvue-nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./data/nginx/log:/var/log/nginx
jvue-mysql:
privileged: true
image: jvue/mysql:5.7.24
container_name: jvue-mysql
build:
context: ./
Expand All @@ -24,4 +38,20 @@ services:
- ./data/mysql/log:/var/log
- ./jvue-mysql/my.cnf:/etc/my.cnf
- ./jvue-mysql/init:/docker-entrypoint-initdb.d/
restart: always
jvue-server:
privileged: true
image: jvue/server:4.0.0
container_name: jvue-server
build:
context: ./
dockerfile: ./jvue-server/Dockerfile
ports:
- "8081:8081"
working_dir: /app
command: mvn clean spring-boot:run -Dspring-boot.run.profiles=docker -DskipTests
volumes:
- ./jvue-server:/app
- ./data/maven/.m2:/root/.m2
- ./data/server/logs:/logs
restart: always
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# 构建docker-compose项目
# docker-compose up
# docker-compose up -V --force-recreate
# docker-compose up -d --force-recreate
version: '3'
services:
jvue-nginx:
privileged: true
image: jvue/nginx:1.15.9
container_name: jvue-nginx
build:
context: ./
dockerfile: ./jvue-nginx/Dockerfile
ports:
- "80:80"
volumes:
- ./jvue-nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./data/nginx/log:/var/log/nginx
jvue-mysql:
privileged: true
image: jvue/mysql:5.7.24
Expand Down
11 changes: 11 additions & 0 deletions jvue-nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#依赖的镜像
FROM nginx:1.15.9-alpine
#镜像创建者的信息
MAINTAINER terwer "csyouwei@gmail.com"
# 设置编码
ENV LANG C.UTF-8
# 设置时区
# ENV TZ Asia/Shanghai
ENV TZ CST-8
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
14 changes: 14 additions & 0 deletions jvue-nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
server {
listen 80;
charset utf-8;

location /api/ {
proxy_set_header X-Real-IP $remote_addr; # 转发用户IP
proxy_pass http://jvue-server:8081; # jvue-server
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}