REMOVE LDAP

This commit is contained in:
beabigegg
2025-09-25 08:44:44 +08:00
commit 333a640a3b
53 changed files with 4231 additions and 0 deletions

21
nginx/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM nginx:alpine
# 移除預設配置
RUN rm /etc/nginx/conf.d/default.conf
# 複製自定義配置
COPY nginx.conf /etc/nginx/nginx.conf
COPY conf.d/ /etc/nginx/conf.d/
# 創建SSL目錄
RUN mkdir -p /etc/nginx/ssl
# 設置正確的權限
RUN chown -R nginx:nginx /etc/nginx && \
chmod -R 755 /etc/nginx
# 暴露端口
EXPOSE 80 443
# 啟動nginx
CMD ["nginx", "-g", "daemon off;"]

83
nginx/conf.d/default.conf Normal file
View File

@@ -0,0 +1,83 @@
# 暫時規範管理系統主站
server {
listen 80;
server_name localhost;
# 重定向到 HTTPS (可選,需要 SSL 證書)
# return 301 https://$server_name$request_uri;
# 應用程式代理
location / {
proxy_pass http://panjit-tempspec-app:5000;
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;
# WebSocket 支援
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 超時設定
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# ONLYOFFICE Document Server 代理
location /onlyoffice/ {
proxy_pass http://panjit-tempspec-onlyoffice:80/;
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;
# ONLYOFFICE 特殊設定
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
# 大檔案上傳支援
client_max_body_size 100M;
proxy_request_buffering off;
}
# 靜態檔案快取
location /static/ {
proxy_pass http://panjit-tempspec-app:5000/static/;
expires 1y;
add_header Cache-Control "public, immutable";
}
# 健康檢查
location /health {
proxy_pass http://panjit-tempspec-app:5000/;
access_log off;
}
# 錯誤頁面
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
}
# HTTPS 設定 (需要 SSL 證書)
# server {
# listen 443 ssl http2;
# server_name localhost;
#
# ssl_certificate /etc/nginx/ssl/cert.pem;
# ssl_certificate_key /etc/nginx/ssl/key.pem;
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384;
# ssl_prefer_server_ciphers off;
# ssl_session_cache shared:SSL:10m;
# ssl_session_timeout 10m;
#
# # HSTS
# add_header Strict-Transport-Security "max-age=63072000" always;
#
# # 其餘配置與 HTTP 相同
# # ...
# }

71
nginx/nginx.conf Normal file
View File

@@ -0,0 +1,71 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
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;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
# 檔案大小限制
client_max_body_size 100M;
client_body_timeout 120s;
client_header_timeout 120s;
# Gzip 壓縮
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_comp_level 6;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/x-javascript
application/json
application/ld+json
application/manifest+json
application/rdf+xml
application/rss+xml
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
# 安全標頭
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Referrer-Policy "strict-origin-when-cross-origin";
# 包含站點配置
include /etc/nginx/conf.d/*.conf;
}