Files
homaroma/serverinfo/192.168.1.24/api.foxxio.ddcsprocket.com.conf
T

53 lines
1.9 KiB
Plaintext

# 1. HTTP: Redirect ทุก Request ไปยัง HTTPS (พร้อมเปิดช่องทางสำหรับ Certbot ต่ออายุ)
server {
listen 80;
server_name api.foxxio.ddcsprocket.com;
# สำหรับ Certbot ACME Challenge (ต่ออายุใบรับรองอัตโนมัติ)
location /.well-known/acme-challenge/ {
root /usr/share/nginx/html;
try_files $uri =404;
}
# Redirect ทั้งหมดไปยัง HTTPS
location / {
return 301 https://$host$request_uri;
}
}
# 2. HTTPS: Proxy ไปยัง Elysia Backend API (Port 3006) บน 192.168.1.26
server {
listen 443 ssl;
server_name api.foxxio.ddcsprocket.com;
# ตำแหน่ง SSL Certificate ของ Let's Encrypt
ssl_certificate /etc/letsencrypt/live/api.foxxio.ddcsprocket.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.foxxio.ddcsprocket.com/privkey.pem;
# Certbot ACME Challenge
location /.well-known/acme-challenge/ {
root /usr/share/nginx/html;
try_files $uri =404;
}
# Backend API: ส่งต่อไปยัง Elysia API บน 192.168.1.26:3006
location / {
proxy_pass http://192.168.1.26:3006;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection 'upgrade';
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# รองรับการอัปโหลดไฟล์ / รูปภาพ
client_max_body_size 50M;
# Buffer settings
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
}