From 581f65dbe56dead1078fdd3c95feac4f1335effd Mon Sep 17 00:00:00 2001 From: vanten-s Date: Sun, 20 Aug 2023 12:58:42 +0200 Subject: [PATCH] I'm testing --- Dockerfile | 5 ---- docker-compose.yml | 12 +++++++- nginx.conf | 62 -------------------------------------- nginx/conf/nginx.conf | 69 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 68 deletions(-) delete mode 100644 Dockerfile delete mode 100644 nginx.conf create mode 100644 nginx/conf/nginx.conf diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 036c224..0000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM nginx:latest - -# Copy config -COPY nginx.conf /etc/nginx/nginx.conf - diff --git a/docker-compose.yml b/docker-compose.yml index 17e8b94..c9e5489 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,15 @@ services: nginx: - build: . + image: nginx:latest network_mode: "host" + volumes: + - ./nginx/conf/:/etc/nginx/conf.d/:ro + - ./certbot/www:/var/www/certbot/:ro + - ./certbot/conf/:/etc/nginx/ssl/:ro + + certbot: + image: certbot/certbot:latest + volumes: + - ./certbot/www/:/var/www/certbot/:rw + - ./certbot/conf/:/etc/letsencrypt/:rw diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 0d96f01..0000000 --- a/nginx.conf +++ /dev/null @@ -1,62 +0,0 @@ -events {} - -http { -server { - listen 80; - return 301 https://$host$request_uri; -} - -server { - server_name nextcloud.vanten-s.com; - - location / { - proxy_pass http://127.0.0.1:11000$request_uri; - - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-Scheme $scheme; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Accept-Encoding ""; - proxy_set_header Host $host; - - client_body_buffer_size 512k; - proxy_read_timeout 86400s; - client_max_body_size 0; - } - - listen 80; -} - -server { - server_name vnc.vanten-s.com; - location / { - proxy_pass http://localhost:8089; - } - - listen 80; -} - -server { - server_name forgejo.vanten-s.com; - client_max_body_size 0; - location / { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_pass http://172.21.0.3:3000/; - } - - listen 80; -} - -server { - server_name vanten-s.com www.vanten-s.com; - location / { - proxy_pass http://172.20.0.2:3000/; - } - - listen 80; -} -} diff --git a/nginx/conf/nginx.conf b/nginx/conf/nginx.conf new file mode 100644 index 0000000..5026e00 --- /dev/null +++ b/nginx/conf/nginx.conf @@ -0,0 +1,69 @@ +events {} + +http { +server { + listen 80; + return 301 https://$host$request_uri; +} + +server { + server_name nextcloud.vanten-s.com; + + location / { + proxy_pass http://127.0.0.1:11000$request_uri; + + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Scheme $scheme; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Accept-Encoding ""; + proxy_set_header Host $host; + + client_body_buffer_size 512k; + proxy_read_timeout 86400s; + client_max_body_size 0; + } + + listen 80; +} + +server { + server_name vnc.vanten-s.com; + location / { + proxy_pass http://localhost:8089; + } + + listen 80; +} + +server { + server_name forgejo.vanten-s.com; + client_max_body_size 0; + location / { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://172.21.0.3:3000/; + } + + listen 80; +} + +server { + server_name vanten-s.com www.vanten-s.com; + server_tokens off; + + location /.well-known/acme-challenge/ { + root /var/www/certbot; + } + + + location / { + proxy_pass http://172.20.0.2:3000/; + } + + listen 80; +} +}