TGViewer
murodalidev /> murodalidev /> @murodalidev · 799 subscribers
Post #629 1.25K
Admin panelga kirishni IP manzillariga limit qo'ying!

Veb-serveringizni shunday sozlangki, faqat ma’lum IP manzillardan Django admin paneliga kirish mumkin bo‘lsin.
Bu sizning veb-serveringiz turiga bog‘liq bo‘ladi, masalan nginx uchun shu linkdagi ko'rsatmalarga amal qiling.

Alternativ usul sifatida bu mantiqni middleware ichiga yozish mumkin, lekin Bu nazoratni web-server darajasida qilish afzal, chunki har bir middleware sizning view’laringiz atrofida qo‘shimcha mantiqiy qatlam hosil qiladi.

Nginx web serverda buni qanday amalga oshirishni ko'ramiz:
upstream app_servers {
server 127.0.0.1:8000;
}

server {
listen 80;

location ^~ /admin/ {
allow 123.456.789.012;
allow 123.456.789.013; # va yana bir nechta IP manzilni qoshishingiz mumkin
deny all;
proxy_pass http://app_servers;
proxy_read_timeout 90;
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 / {
proxy_pass http://app_servers;
proxy_read_timeout 90;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}


@murodalidev ✅
  • 🔥 11
  • ⚡ 3
More from @murodalidev
  1. Jul 10, 2026Ma'lumotlar bilan ishlaganda eng katta muammo - tartibsizlik. Xom, tozalanmagan ma'lumotda…
  2. Jun 19, 2026Every challenge, every adversity, contains within it the seeds of opportunity and growth
  3. Feb 9, 2026ChatGPT: Create a caricature of me and my job based on everything you know about me. @muro…
  4. Dec 23, 2025Dasturchilar katta loyihalarni qilib boshlashganlarida bir qancha qiyinchiliklarda duch ke…
  5. Dec 18, 2025Hammaga salom👋 Odatda tez-tez so‘rovnoma yubormayman. Hozir AsyncIO [python] bo'yicha max…
  6. Nov 17, 2025Data Science 21-asrning eng yaxshi kasbi ekan, o'qinglar!) @murodalidev
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →