Skip to content

Instantly share code, notes, and snippets.

@maethu
Last active July 13, 2022 19:11
Show Gist options
  • Save maethu/2c12d05aebf80c92cfb43ec35b723333 to your computer and use it in GitHub Desktop.
Save maethu/2c12d05aebf80c92cfb43ec35b723333 to your computer and use it in GitHub Desktop.
# NGINX CONFIG
upstream plone {
server cms:8080;
}
server {
listen 80;
server_name dev-backend.webcloud7.ch;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://dev-backend.webcloud7.ch$request_uri;
}
}
server {
listen 443 default_server ssl http2;
server_name dev-backend.webcloud7.ch;
ssl_certificate /etc/nginx/ssl/live/dev-backend.webcloud7.ch/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/live/dev-backend.webcloud7.ch/privkey.pem;
location / {
#proxy_pass http://plone/VirtualHostBase/http/dev-backend.webcloud7.ch:80/Plone/VirtualHostRoot/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
rewrite ^(.*)$ /VirtualHostBase/https/dev-backend.webcloud7.ch:443/Plone/VirtualHostRoot/$1 break;
proxy_pass http://plone;
}
}
# docker-compose.yaml
version: "3.8"
services:
cms:
image: plone-backend:latest
ports:
- 8080:8080
webserver:
image: nginx:latest
ports:
- 80:80
- 443:443
restart: always
depends_on:
- cms
volumes:
- ./var/nginx/conf/:/etc/nginx/conf.d/
- ./certbot/www:/var/www/certbot/
- ./certbot/conf/:/etc/nginx/ssl/
certbot:
image: certbot/certbot:latest
volumes:
- ./certbot/www/:/var/www/certbot/
- ./certbot/conf/:/etc/letsencrypt/
# Create certificate
docker-compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d dev-backend.webcloud7.ch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment