2023-05-25 22:41:41 +05:30
|
|
|
|
user nginx;
|
|
|
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
#tcp_nopush on;
|
|
|
|
|
|
|
|
|
|
|
|
keepalive_timeout 65;
|
|
|
|
|
|
|
|
|
|
|
|
#gzip on;
|
|
|
|
|
|
|
|
|
|
|
|
server {
|
2024-10-28 02:20:28 +00:00
|
|
|
|
listen 80;
|
|
|
|
|
|
server_name localhost;
|
|
|
|
|
|
|
|
|
|
|
|
# 静的ファイルの提供
|
2023-05-25 22:41:41 +05:30
|
|
|
|
location /static/ {
|
2024-10-28 02:20:28 +00:00
|
|
|
|
alias /app/static/;
|
2023-05-26 13:56:26 +05:30
|
|
|
|
}
|
2024-10-28 02:20:28 +00:00
|
|
|
|
|
2025-09-06 02:56:50 +09:00
|
|
|
|
# スーパーバイザー Web アプリケーション(特定パス)
|
|
|
|
|
|
location = / {
|
2024-10-28 02:20:28 +00:00
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
|
index index.html;
|
2025-09-06 02:56:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
location = /index.html {
|
|
|
|
|
|
root /usr/share/nginx/html;
|
2024-10-28 02:20:28 +00:00
|
|
|
|
}
|
2025-08-24 19:44:36 +09:00
|
|
|
|
|
|
|
|
|
|
# スーパーバイザー専用の静的ファイル
|
|
|
|
|
|
location /supervisor/ {
|
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
|
try_files $uri $uri/ =404;
|
|
|
|
|
|
}
|
2025-09-06 02:56:50 +09:00
|
|
|
|
|
|
|
|
|
|
# Django ログアウト・ログイン系の処理
|
|
|
|
|
|
location /accounts/ {
|
|
|
|
|
|
proxy_pass http://app: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_connect_timeout 60s;
|
|
|
|
|
|
proxy_send_timeout 60s;
|
|
|
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
|
client_max_body_size 50M;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ろげイニングアプリ専用API(重要!)
|
|
|
|
|
|
location /gifuroge/ {
|
|
|
|
|
|
proxy_pass http://app: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;
|
|
|
|
|
|
|
|
|
|
|
|
# タイムアウト設定(502エラー対策)
|
|
|
|
|
|
proxy_connect_timeout 60s;
|
|
|
|
|
|
proxy_send_timeout 60s;
|
|
|
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
|
|
|
|
|
|
|
# バッファ設定(大きなレスポンス対策)
|
|
|
|
|
|
proxy_buffering on;
|
|
|
|
|
|
proxy_buffer_size 8k;
|
|
|
|
|
|
proxy_buffers 8 8k;
|
|
|
|
|
|
proxy_busy_buffers_size 16k;
|
|
|
|
|
|
proxy_temp_file_write_size 16k;
|
|
|
|
|
|
|
|
|
|
|
|
# クライアント設定(画像アップロード対応)
|
|
|
|
|
|
client_max_body_size 100M;
|
|
|
|
|
|
}
|
2024-10-28 02:20:28 +00:00
|
|
|
|
|
2025-09-06 10:11:06 +09:00
|
|
|
|
# 🔧 スマホアプリ互換性対応: /api/checkin_from_rogapp の特別処理
|
2025-09-06 03:01:44 +09:00
|
|
|
|
location /api/checkin_from_rogapp {
|
2025-09-06 10:11:06 +09:00
|
|
|
|
proxy_pass http://app:8000/api/checkin_from_rogapp;
|
2025-09-06 03:01:44 +09:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
# タイムアウト設定(502エラー対策)
|
|
|
|
|
|
proxy_connect_timeout 60s;
|
|
|
|
|
|
proxy_send_timeout 60s;
|
|
|
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
|
|
|
|
|
|
|
# バッファ設定(大きなレスポンス対策)
|
|
|
|
|
|
proxy_buffering on;
|
|
|
|
|
|
proxy_buffer_size 8k;
|
|
|
|
|
|
proxy_buffers 8 8k;
|
|
|
|
|
|
proxy_busy_buffers_size 16k;
|
|
|
|
|
|
proxy_temp_file_write_size 16k;
|
|
|
|
|
|
|
|
|
|
|
|
# クライアント設定(画像アップロード対応)
|
|
|
|
|
|
client_max_body_size 100M;
|
2025-09-06 10:11:06 +09:00
|
|
|
|
|
|
|
|
|
|
# ログ記録強化
|
|
|
|
|
|
access_log /var/log/nginx/checkin_access.log main;
|
|
|
|
|
|
error_log /var/log/nginx/checkin_error.log warn;
|
2025-09-06 03:01:44 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-28 02:20:28 +00:00
|
|
|
|
# Django API プロキシ
|
|
|
|
|
|
location /api/ {
|
2025-08-24 19:44:36 +09:00
|
|
|
|
proxy_pass http://app: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;
|
2025-09-02 23:27:34 +09:00
|
|
|
|
|
|
|
|
|
|
# タイムアウト設定(502エラー対策)
|
|
|
|
|
|
proxy_connect_timeout 60s;
|
|
|
|
|
|
proxy_send_timeout 60s;
|
|
|
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
|
|
|
|
|
|
|
# バッファ設定(大きなレスポンス対策)
|
|
|
|
|
|
proxy_buffering on;
|
|
|
|
|
|
proxy_buffer_size 8k;
|
|
|
|
|
|
proxy_buffers 8 8k;
|
|
|
|
|
|
proxy_busy_buffers_size 16k;
|
|
|
|
|
|
proxy_temp_file_write_size 16k;
|
|
|
|
|
|
|
|
|
|
|
|
# クライアント設定
|
|
|
|
|
|
client_max_body_size 50M;
|
2025-08-24 19:44:36 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Django Admin プロキシ
|
|
|
|
|
|
location /admin/ {
|
|
|
|
|
|
proxy_pass http://app:8000;
|
2023-05-25 22:41:41 +05:30
|
|
|
|
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;
|
2025-09-02 23:27:34 +09:00
|
|
|
|
|
|
|
|
|
|
# タイムアウト設定
|
|
|
|
|
|
proxy_connect_timeout 60s;
|
|
|
|
|
|
proxy_send_timeout 60s;
|
|
|
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
|
|
|
|
|
|
|
# バッファ設定
|
|
|
|
|
|
proxy_buffering on;
|
|
|
|
|
|
proxy_buffer_size 8k;
|
|
|
|
|
|
proxy_buffers 8 8k;
|
|
|
|
|
|
proxy_busy_buffers_size 16k;
|
|
|
|
|
|
|
|
|
|
|
|
# クライアント設定
|
|
|
|
|
|
client_max_body_size 50M;
|
2023-05-25 22:41:41 +05:30
|
|
|
|
}
|
2025-09-06 02:56:50 +09:00
|
|
|
|
|
|
|
|
|
|
# Django メインアプリケーション(rog/以下)
|
|
|
|
|
|
location /rog/ {
|
|
|
|
|
|
proxy_pass http://app: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_connect_timeout 60s;
|
|
|
|
|
|
proxy_send_timeout 60s;
|
|
|
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
|
client_max_body_size 100M;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Django その他のパス(デフォルト)
|
|
|
|
|
|
location ~ ^/(media|favicon\.ico|robots\.txt) {
|
|
|
|
|
|
proxy_pass http://app: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;
|
|
|
|
|
|
}
|
2024-10-28 02:20:28 +00:00
|
|
|
|
|
|
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
2023-05-25 22:41:41 +05:30
|
|
|
|
location = /50x.html {
|
2024-10-28 02:20:28 +00:00
|
|
|
|
root /usr/share/nginx/html;
|
2023-05-25 22:41:41 +05:30
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|