Skip to content

Commit

Permalink
docker-compose.yml 添加nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
longfeizheng committed Mar 30, 2018
1 parent 34b5e7e commit 32bebf1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hub.c.163.com/wuxukun/maven-aliyun:3-jdk-8
ADD ["target/spring-security.jar", "app.jar"]
EXPOSE 80 80
EXPOSE 80
ENTRYPOINT ["java","-jar","/app.jar"]
18 changes: 15 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
version: '2'
services:
nginx:
container_name: logback-nginx
image: nginx:1.13
restart: always
ports:
- "80:80"
# - 443:443
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d

mysqldb:
image: mysql:5.7
container_name: mysqldb
Expand All @@ -8,16 +18,18 @@ services:
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: dbperson

redis:
image: "redis:alpine"
container_name: redisdb
ports:
- "6379:6379"

logback:
container_name: logback
build: .
restart: always
ports:
- "80:80"
depends_on:
- mysqldb
- redis
- redis
- nginx
19 changes: 19 additions & 0 deletions nginx/conf.d/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
listen 80;
charset utf-8;
access_log off;

location / {
proxy_pass http://logback:80;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /static {
access_log off;
expires 30d;
alias /app/static;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/ormtest?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://localhost:3306/dbperson?useUnicode=true&characterEncoding=UTF-8
username: root
password: admin
redis:
Expand Down

0 comments on commit 32bebf1

Please sign in to comment.