@@ -8,8 +8,73 @@ Assuming that have :
88- VPS with an ip address like ` 10.110.120.130 `
99- One or multiple domain and/or subdomain like ` example.com `
1010- A configured domain redirection with ` A ` type like ` A - 10.110.120.130 -> example.com `
11+ - A webapp or service that we want to use ` example.com ` domain like ` wordpress `
12+
13+ ## Configuration
14+ On VPS, create related network, all services with a ` VIRTUAL_HOST ` must be connected to this network
15+
16+ ``` shell
17+ docker network create nginx-proxy
18+ ```
19+
20+ If we take for example that we have a wordpress in a docker-compose like that:
21+ (example from official samples https://docs.docker.com/samples/wordpress )
22+ ``` diff
23+ version: "3.9"
24+
25+ services:
26+ db:
27+ image: mysql:5.7
28+ volumes:
29+ - db_data:/var/lib/mysql
30+ restart: always
31+ environment:
32+ MYSQL_ROOT_PASSWORD: somewordpress
33+ MYSQL_DATABASE: wordpress
34+ MYSQL_USER: wordpress
35+ MYSQL_PASSWORD: wordpress
36+
37+ wordpress:
38+ depends_on:
39+ - db
40+ image: wordpress:latest
41+ volumes:
42+ - wordpress_data:/var/www/html
43+ ports:
44+ - "8000:80"
45+ restart: always
46+ environment:
47+ WORDPRESS_DB_HOST: db
48+ WORDPRESS_DB_USER: wordpress
49+ WORDPRESS_DB_PASSWORD: wordpress
50+ WORDPRESS_DB_NAME: wordpress
51+ + VIRTUAL_HOST: ${DOMAIN}
52+ volumes:
53+ db_data: {}
54+ wordpress_data: {}
55+
56+ + networks:
57+ + default:
58+ + external:
59+ + name: nginx-proxy
60+ ```
61+
62+ *** note: if your service doesn't work on port 80, you can define a ` VIRTUAL_PORT ` variable with right service port***
63+
64+ After updated ` docker-compose.yml ` run
65+
66+ ``` shell
67+ docker-compose stop wordpress
68+ docker-compose build wordpress --no-cache
69+ docker-compose up -d
70+ ```
1171
1272## Setup
1373On VPS, in apps or webservice or another folder
1474``` shell
15- ```
75+ git clone git@github.com:Eth3rnit3/configured-compose-nginx-proxy.git
76+ cd configured-compose-nginx-proxy
77+ docker-compose up -d
78+ ```
79+
80+ Et voilà! You can log ` nginx-proxy ` and ` nginx-proxy-letsencrypt ` for debug if need. On the first time, ` letsencrypt ` generate ssl certificate, after a quick initialization for that, you can access to your webservice on https://example.com
0 commit comments