Browse Source
Update production environment configuration and add Nginx server configurations for dovodi and imamjavad services
master
Update production environment configuration and add Nginx server configurations for dovodi and imamjavad services
master
3 changed files with 297 additions and 1 deletions
-
2.env.prod
-
143nginx/dovodi.conf
-
153nginx/imamjavad.conf
@ -0,0 +1,143 @@ |
|||
server { |
|||
listen 80; |
|||
# listen 443 ssl; |
|||
server_name dovodi.newhorizonco.uk dovoodi.newhorizonco.uk; |
|||
# ssl_certificate /etc/nginx/certs/nwhco.pem; |
|||
# ssl_certificate_key /etc/nginx/certs/nwhco.key; |
|||
# include /etc/nginx/options-ssl-nginx.conf; |
|||
|
|||
client_max_body_size 500M; |
|||
client_body_timeout 600s; |
|||
client_header_timeout 60s; |
|||
proxy_connect_timeout 600s; |
|||
proxy_send_timeout 600s; |
|||
proxy_read_timeout 600s; |
|||
|
|||
# ========== Django Admin Paths (باید قبل از location / باشند) ========== |
|||
|
|||
# با prefix زبانی |
|||
location /en/dovoodi/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
location /fa/dovoodi/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
# بدون prefix زبانی (fallback) |
|||
location /dovoodi/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
# ========== Admin Entry Points ========== |
|||
|
|||
location = /admin { |
|||
return 301 /admin/; |
|||
} |
|||
|
|||
location /admin/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
location = /admin/logout { |
|||
return 301 /en/dovoodi/admin/logout/; |
|||
} |
|||
|
|||
# مسیر عمومی admin (سازگاری با config قدیمی) |
|||
location /en/admin { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
# ========== Django Services ========== |
|||
|
|||
location /api { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_method $request_method; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
|
|||
# 🔥 CRITICAL: Forward Authorization header for Token authentication |
|||
proxy_set_header Authorization $http_authorization; |
|||
proxy_pass_header Authorization; |
|||
|
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
location /en/swagger { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header Authorization $http_authorization; |
|||
proxy_pass_header Authorization; |
|||
} |
|||
|
|||
location /en/redoc { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header Authorization $http_authorization; |
|||
proxy_pass_header Authorization; |
|||
} |
|||
|
|||
location /i18n/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
} |
|||
|
|||
# ========== Static & Media Files ========== |
|||
|
|||
location /static/ { |
|||
alias /home/app/web/imam_javad_static/static/; |
|||
} |
|||
|
|||
location /media/ { |
|||
alias /home/app/web/imam_javad_static/media/; |
|||
} |
|||
|
|||
# ========== Next.js Frontend ========== |
|||
|
|||
location /_next/ { |
|||
proxy_pass http://88.99.212.243:7227/_next/; |
|||
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; |
|||
expires 1y; |
|||
add_header Cache-Control "public, immutable"; |
|||
} |
|||
|
|||
# ⚠️ این باید آخرین location باشد (fallback) |
|||
location / { |
|||
proxy_pass http://88.99.212.243:7227; |
|||
client_max_body_size 1200M; |
|||
proxy_set_header Upgrade $http_upgrade; |
|||
proxy_set_header Connection "upgrade"; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
} |
|||
} |
|||
@ -0,0 +1,153 @@ |
|||
server { |
|||
listen 80; |
|||
# listen 443 ssl; |
|||
server_name imamjavad.nwhco.ir imamjavad.newhorizonco.uk; |
|||
# ssl_certificate /etc/nginx/certs/nwhco.pem; |
|||
# ssl_certificate_key /etc/nginx/certs/nwhco.key; |
|||
# include /etc/nginx/options-ssl-nginx.conf; |
|||
|
|||
client_max_body_size 500M; |
|||
client_body_timeout 600s; |
|||
client_header_timeout 60s; |
|||
proxy_connect_timeout 600s; |
|||
proxy_send_timeout 600s; |
|||
proxy_read_timeout 600s; |
|||
|
|||
# ========== Django Admin Paths (باید قبل از location / باشند) ========== |
|||
|
|||
# با prefix زبانی |
|||
location /en/imam-javad/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
location /fa/imam-javad/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
# بدون prefix زبانی (fallback) |
|||
location /imam-javad/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
# ========== Admin Entry Points ========== |
|||
|
|||
location = /admin { |
|||
return 301 /admin/; |
|||
} |
|||
|
|||
location /admin/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
location = /admin/logout { |
|||
return 301 /en/imam-javad/admin/logout/; |
|||
} |
|||
|
|||
# مسیر عمومی admin (سازگاری با config قدیمی) |
|||
location /en/admin { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
# ========== Django Services ========== |
|||
|
|||
location /api { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_method $request_method; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
|
|||
# 🔥 CRITICAL: Forward Authorization header for Token authentication |
|||
proxy_set_header Authorization $http_authorization; |
|||
proxy_pass_header Authorization; |
|||
|
|||
client_max_body_size 1200M; |
|||
} |
|||
|
|||
location /en/swagger { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header Authorization $http_authorization; |
|||
proxy_pass_header Authorization; |
|||
} |
|||
|
|||
location /en/redoc { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header Authorization $http_authorization; |
|||
proxy_pass_header Authorization; |
|||
} |
|||
|
|||
location /i18n/ { |
|||
proxy_pass http://88.99.212.243:8010; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
proxy_set_header Host $host; |
|||
} |
|||
|
|||
# ========== Other Services ========== |
|||
|
|||
location /chat { |
|||
proxy_pass http://88.99.212.243:8020; |
|||
client_max_body_size 1200M; |
|||
proxy_set_header Upgrade $http_upgrade; |
|||
proxy_set_header Connection "upgrade"; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
} |
|||
|
|||
location /static/ { |
|||
alias /home/app/web/imam_javad_static/static/; |
|||
} |
|||
|
|||
location /media/ { |
|||
alias /home/app/web/imam_javad_static/media/; |
|||
} |
|||
|
|||
# ========== Next.js Frontend ========== |
|||
|
|||
location /_next/ { |
|||
proxy_pass http://88.99.212.243:7226/_next/; |
|||
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; |
|||
expires 1y; |
|||
add_header Cache-Control "public, immutable"; |
|||
} |
|||
|
|||
# ⚠️ این باید آخرین location باشد (fallback) |
|||
location / { |
|||
proxy_pass http://88.99.212.243:7226; |
|||
client_max_body_size 1200M; |
|||
proxy_set_header Upgrade $http_upgrade; |
|||
proxy_set_header Connection "upgrade"; |
|||
proxy_set_header Host $host; |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue