Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ docker compose down

On first start, `nginx/whitelist.conf` is auto-created from `whitelist.conf.example`. Edit that file if you need to restrict allowed IP addresses.

To enable SSL (HTTPS), configure SSL settings in `.env` and place certificates in `nginx/ssl`:
To enable SSL (HTTPS), configure SSL settings in `.env` and place certificates in `nginx/certs`:

```bash
SSL_ENABLE=true
Expand All @@ -73,7 +73,7 @@ SSL_KEY_FILE=privkey.pem
```

```bash
nginx/ssl/
nginx/certs/
├── cert.pem # Your SSL certificate
└── privkey.pem # Your private key
```
Expand Down
8 changes: 4 additions & 4 deletions docker-compose-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/templates:/etc/nginx/templates
- ./nginx/custom.d:/etc/nginx/custom.d
- ./nginx/ssl:/etc/nginx/ssl
- ./nginx/certs:/etc/nginx/certs
- ./nginx/logs:/var/log/nginx
- ./nginx:/etc/nginx/host:rw
- ./nginx/logrotate/nginx:/etc/logrotate.d/nginx
Expand Down Expand Up @@ -146,7 +146,7 @@ services:
condition: service_started
networks:
- backend-network
restart: always
restart: always
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:5000/healthz || exit 1"]
interval: 10s
Expand Down Expand Up @@ -180,7 +180,7 @@ services:
interval: 30s
timeout: 5s
retries: 5

phpmyadmin:
image: phpmyadmin/phpmyadmin:5.2.3
environment:
Expand Down Expand Up @@ -383,4 +383,4 @@ networks:
frontend-network:
driver: bridge
backend-network:
driver: bridge
driver: bridge
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/templates:/etc/nginx/templates
- ./nginx/custom.d:/etc/nginx/custom.d
- ./nginx/ssl:/etc/nginx/ssl
- ./nginx/certs:/etc/nginx/certs
- ./nginx/logs:/var/log/nginx
- ./nginx:/etc/nginx/host:rw
- ./nginx/logrotate/nginx:/etc/logrotate.d/nginx
Expand Down
4 changes: 2 additions & 2 deletions nginx/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SSL
# Certificates
*.pem
*.key
*.crt
*.csr

# Custom Configurations
custom.d/*.conf
whitelist.conf
whitelist.conf
6 changes: 3 additions & 3 deletions nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ SSL_CERT_FILE=cert.pem
SSL_KEY_FILE=privkey.pem
```

Place your certificates in the `nginx/ssl` directory:
Place your certificates in the `nginx/certs` directory:
```bash
nginx/ssl/
nginx/certs/
├── cert.pem # Your SSL certificate
└── privkey.pem # Your private key
```
```
File renamed without changes.
8 changes: 4 additions & 4 deletions nginx/templates/backend.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ server {
listen {{ .Env.BACKEND_PORT }};
{{ end }}
server_name {{ .Env.HOSTNAME }};

{{ if eq .Env.SSL_ENABLE "true" }}
# Redirect HTTP to HTTPS when accessing HTTPS port
error_page 497 =301 https://$host:$server_port$request_uri;

ssl_certificate /etc/nginx/ssl/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/ssl/{{ .Env.SSL_KEY_FILE }};
ssl_certificate /etc/nginx/certs/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/certs/{{ .Env.SSL_KEY_FILE }};

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
Expand Down Expand Up @@ -58,4 +58,4 @@ server {
proxy_pass_request_headers on;
proxy_pass_request_body on;
}
}
}
14 changes: 7 additions & 7 deletions nginx/templates/frontend.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ server {
listen {{ .Env.FRONTEND_PORT }};
{{ end }}
server_name {{ .Env.HOSTNAME }};

{{ if eq .Env.SSL_ENABLE "true" }}
# Redirect HTTP to HTTPS when accessing HTTPS port
error_page 497 =301 https://$host:$server_port$request_uri;

ssl_certificate /etc/nginx/ssl/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/ssl/{{ .Env.SSL_KEY_FILE }};
ssl_certificate /etc/nginx/certs/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/certs/{{ .Env.SSL_KEY_FILE }};

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_prefer_server_ciphers off;

# HSTS - Only enable when SSL is enabled
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
{{ end }}

# Increase WebSocket timeout settings
Expand All @@ -40,7 +40,7 @@ server {
{{ if eq .Env.NODE_ENV "production" }}
# Production configuration
root /usr/share/nginx/html;

# Handle static assets
location /assets/ {
alias /usr/share/nginx/html/assets/;
Expand Down Expand Up @@ -78,4 +78,4 @@ server {
proxy_pass_request_body on;
}
{{ end }}
}
}
8 changes: 4 additions & 4 deletions nginx/templates/grafana.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ server {
listen {{ .Env.GRAFANA_PORT }};
{{ end }}
server_name {{ .Env.HOSTNAME }};

{{ if eq .Env.SSL_ENABLE "true" }}
# Redirect HTTP to HTTPS when accessing HTTPS port
error_page 497 =301 https://$host:$server_port$request_uri;

ssl_certificate /etc/nginx/ssl/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/ssl/{{ .Env.SSL_KEY_FILE }};
ssl_certificate /etc/nginx/certs/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/certs/{{ .Env.SSL_KEY_FILE }};

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
Expand Down Expand Up @@ -58,4 +58,4 @@ server {
proxy_pass_request_headers on;
proxy_pass_request_body on;
}
}
}
8 changes: 4 additions & 4 deletions nginx/templates/phpmyadmin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ server {
listen {{ .Env.PMA_PORT }};
{{ end }}
server_name {{ .Env.HOSTNAME }};

{{ if eq .Env.SSL_ENABLE "true" }}
# Redirect HTTP to HTTPS when accessing HTTPS port
error_page 497 =301 https://$host:$server_port$request_uri;

ssl_certificate /etc/nginx/ssl/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/ssl/{{ .Env.SSL_KEY_FILE }};
ssl_certificate /etc/nginx/certs/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/certs/{{ .Env.SSL_KEY_FILE }};

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
Expand Down Expand Up @@ -57,4 +57,4 @@ server {
proxy_pass_request_headers on;
proxy_pass_request_body on;
}
}
}
10 changes: 5 additions & 5 deletions nginx/templates/redis.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ server {
listen {{ .Env.REDIS_INSIGHT_PORT }};
{{ end }}
server_name {{ .Env.HOSTNAME }};

{{ if eq .Env.SSL_ENABLE "true" }}
# Redirect HTTP to HTTPS when accessing HTTPS port
error_page 497 =301 https://$host:$server_port$request_uri;

ssl_certificate /etc/nginx/ssl/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/ssl/{{ .Env.SSL_KEY_FILE }};
ssl_certificate /etc/nginx/certs/{{ .Env.SSL_CERT_FILE }};
ssl_certificate_key /etc/nginx/certs/{{ .Env.SSL_KEY_FILE }};

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
Expand All @@ -32,7 +32,7 @@ server {
{{ if and .Env.REDIS_INSIGHT_USER .Env.REDIS_INSIGHT_PASSWORD }}
auth_basic "Redis Insight Access";
auth_basic_user_file /etc/nginx/.htpasswd;

# Additional security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
Expand All @@ -56,4 +56,4 @@ server {
proxy_pass_request_headers on;
proxy_pass_request_body on;
}
}
}
Loading