Fix minor typo errors | Change Nginx for Caddy | Consolidate templates in this repo

This commit is contained in:
2025-01-24 02:57:53 -03:00
parent 21515daef1
commit ddf0301463
15 changed files with 254 additions and 35 deletions

View File

@@ -0,0 +1,22 @@
services:
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./static:/var/www/static # For static content delivery
- ./nginx/conf.d:/etc/nginx/conf.d # Your sites conf files
- ./nginx/nginx.conf:/etc/nginx/nginx.conf # Main NginX config file
- ./certbot/www:/var/www/certbot
- ./certbot/conf:/etc/letsencrypt # Stores certificates
restart: unless-stopped
depends_on:
- certbot
certbot:
image: certbot/certbot
volumes:
- ./certbot/www:/var/www/certbot
- ./certbot/conf:/etc/letsencrypt
restart: unless-stopped

View File

@@ -0,0 +1,38 @@
# Reverse proxy
server {
listen 80;
server_name api.domain.com;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name api.domain.com;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/api.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.domain.com/privkey.pem;
location / {
proxy_pass http://localhost:{LOCAL_NETWORK_PORT}/;
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-Host $host;
# WebSocket support
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
# Change upload max size
client_max_body_size 50M;
}
}

View File

@@ -0,0 +1,29 @@
# Static delivery
server {
listen 80;
server_name test.domain.com;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name test.domain.com;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/test.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.domain.com/privkey.pem;
location / {
root /var/www/static;
index index.html;
}
}

View File

@@ -0,0 +1,24 @@
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;
include /etc/nginx/conf.d/*.conf; # Include all childs in ./conf.d
}