Files
smartsoltech_site/nginx-smartsoltech.conf
Andrew K. Choi b93ab4d796 🌐 Add Nginx configuration and setup scripts
- Added nginx-smartsoltech.conf: Ready-to-use Nginx config with SSL, proxy, security headers
- Added setup-nginx.sh: Automated Nginx setup script with symlink creation
- Added NGINX_SETUP.md: Comprehensive Nginx setup guide with troubleshooting
- Added NGINX_QUICK_SETUP.md: Quick reference cheatsheet

Features:
- HTTP to HTTPS redirect
- www to non-www redirect
- Proxy to Django (localhost:8000)
- SSL configuration (ready for Let's Encrypt)
- Security headers (HSTS, XSS, etc)
- Logging configuration
- Automated default removal and symlink creation
2025-11-24 11:49:52 +09:00

90 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SmartSolTech Nginx Configuration
# Скопировать в: /etc/nginx/sites-available/smartsoltech
# Редирект с www на non-www
server {
listen 80;
listen [::]:80;
server_name www.smartsoltech.kr;
return 301 https://smartsoltech.kr$request_uri;
}
# HTTP → HTTPS редирект
server {
listen 80;
listen [::]:80;
server_name smartsoltech.kr;
# Let's Encrypt challenge
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$server_name$request_uri;
}
}
# HTTPS конфигурация
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name smartsoltech.kr;
# SSL сертификаты (раскомментировать после получения от Let's Encrypt)
# ssl_certificate /etc/letsencrypt/live/smartsoltech.kr/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/smartsoltech.kr/privkey.pem;
# ssl_trusted_certificate /etc/letsencrypt/live/smartsoltech.kr/chain.pem;
# SSL настройки
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# Security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# Максимальный размер загружаемых файлов
client_max_body_size 100M;
# Логи
access_log /var/log/nginx/smartsoltech_access.log;
error_log /var/log/nginx/smartsoltech_error.log;
# Прокси к Django приложению
location / {
proxy_pass http://localhost:8000;
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-Proto $scheme;
proxy_redirect off;
proxy_buffering off;
# Таймауты
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# Статические файлы (опционально, если выносить из Docker)
# Раскомментировать если хотите отдавать статику напрямую из Nginx
# location /static/ {
# alias /opt/smartsoltech_site/smartsoltech/staticfiles/;
# expires 30d;
# add_header Cache-Control "public, immutable";
# }
# Медиа файлы (опционально, если выносить из Docker)
# location /media/ {
# alias /opt/smartsoltech_site/smartsoltech/media/;
# expires 7d;
# add_header Cache-Control "public";
# }
}