Today I put my current domaine under the CloudFlare DNS. dns records
On my server, I currently use the jWilder/reverse-proxy And for other subdomains or main domaines I use Apache2 or Nginx v1.22.
Everything is used under Docker containers.
docker-compose of the reverse proxy :
version: '2'
networks:
webproxy:
driver: bridge
services:
nginx-proxy:
image: jwilder/nginx-proxy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- /etc/nginx/certs
- /etc/nginx/vhost.d
- /usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./logs/error.log:/var/log/nginx/error.log
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
- webproxy
environment:
- TRUST_DOWNSTREAM_PROXY=true
nginx-proxy-letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes:
- /etc/nginx/certs
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes_from:
- nginx-proxy
nginx reverse-proxy configuration :
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
client_max_body_size 20m;
gzip on;
include /etc/nginx/conf.d/*.conf;
}
daemon off;
Website configuration : docker-compose:
version: '2'
networks:
webproxy:
external:
name: main_webproxy
services:
nginx:
image: nginx:${NGINX_VERSION}
restart: always
volumes:
- ./html:/var/www/html
- ./config/nginx.conf:/etc/nginx/nginx.conf
- ./logs/nginx:/var/log/nginx
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- VIRTUAL_HOST=${APP_DOMAINS}
- VIRTUAL_PORT=80
- LETSENCRYPT_HOST=${APP_DOMAINS}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
expose:
- 80
networks:
- webproxy
- default
nginx config:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen [::]:80;
listen 80;
server_name _;
root /var/www/html;
index index.html;
if ($host ~* ^(www\.)(.+)) {
set $app_domain $2;
rewrite ^ $scheme://$app_domain$request_uri;
}
location / {
try_files $uri $uri/ =404;
}
}
}
.env file:
COMPOSE_PROJECT_NAME=website
NGINX_VERSION=1.22
APP_DOMAINS=domain.tld
But I got error 500 when I want to visit my website : visiting error 500
Could you please help me to make this reverse proxy works please, Thanks
Is tried this change, but not working, still 500 error : Changing CloudFlare SSL to FLEXIBLE or FULL.