Skip to content

Commit

Permalink
cert_cloudflare
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroMartinSteenstrup committed May 18, 2024
1 parent f7eeb43 commit b3dd035
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ portfolio.session.sql
psd
thumb
sketch
.vscode
.vscode
portfolio/origin_ca.pem
portfolio/origin_ca.key
portfolio/nginx/certs/origin_ca.key
portfolio/nginx/certs/origin_ca.pem
portfolio/nginx/certs/default.cert
portfolio/nginx/certs/default.key
7 changes: 4 additions & 3 deletions portfolio/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ services:
- portfolio
restart: unless-stopped
server:
# restart: always
env_file:
- .env
environment:
Expand All @@ -48,10 +49,10 @@ services:
context: ./nginx
dockerfile: Dockerfile
ports:
- ${NGINX_PORT}:${NGINX_PORT}
- ${NGINX_PORT_HTTP}:${NGINX_PORT_HTTP}
- ${NGINX_PORT_HTTPS}:${NGINX_PORT_HTTPS}
volumes:
- origin_ca.pem:/etc/ssl/origin_ca.pem:ro
- origin_ca.key:/etc/ssl/origin_ca.key:ro
- ./nginx/certs:/etc/nginx/certs
# - certbot-etc:/etc/letsencrypt
# - certbot-var:/var/lib/letsencrypt
depends_on:
Expand Down
7 changes: 7 additions & 0 deletions portfolio/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ FROM nginx:bookworm

RUN rm /etc/nginx/conf.d/default.conf

RUN mkdir /etc/nginx/ssl
RUN chown -R root:root /etc/nginx/ssl
RUN chmod -R 600 /etc/nginx/ssl

# COPY ./certs/origin_ca.pem /etc/nginx/ssl/default.cert
# COPY ./certs/origin_ca.key /etc/nginx/ssl/default.key

COPY nginx.conf /etc/nginx/templates/default.conf.conf

# CMD ["nginx", "-g", "daemon off;"]
10 changes: 5 additions & 5 deletions portfolio/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
server {
listen ${NGINX_PORT};
listen [::]:${NGINX_PORT};
listen ${NGINX_PORT_HTTPS} ssl;
listen [::]:${NGINX_PORT_HTTPS};

ssl on;
ssl_certificate /etc/ssl/origin_ca.pem;
ssl_certificate_key /etc/ssl/origin_ca.key;
# ssl on;
ssl_certificate /etc/nginx/certs/default.cert;
ssl_certificate_key /etc/nginx/certs/default.key;

server_name ${SERVER_NAME};

Expand Down

0 comments on commit b3dd035

Please sign in to comment.