推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
pc10201
V2EX  ›  Python

如何在 nginx 和 django 处理网站验证文件.txt

  •  
  •   pc10201 · Aug 26, 2015 · 3347 views
    This topic created in 3979 days ago, the information mentioned may be changed or developed.
    有一些服务需要验证域名权限,要求你放一个 txt 在网站根目录下
    以前在 php 的网站中,直接扔上去就行了

    自己用 django,nginx,uwsgi 做了一个网站,怎么实现上面的功能?
    自己写的规则

    location ~* \.(txt )$ {
    root /home/wwwroot/xxxx/;
    }

    怎么都不起作用,直接写死吧,感觉又不太灵活~
    6 replies    2015-08-26 21:41:55 +08:00
    kslr
        1
    kslr  
       Aug 26, 2015
    什么都不用写,默认都指向了
    nealnote
        2
    nealnote  
       Aug 26, 2015
    加 meta 的方法,验证一般都有几种方法,
    meta 用完,删掉
    wangyongbo
        3
    wangyongbo  
       Aug 26, 2015
    location ~\.(txt|html )$ {
    root /wwwwwwwwwwwwwwwwwwwww/;
    }

    我这么写,可以用。
    mkeith
        4
    mkeith  
       Aug 26, 2015
    django 加个路由呗 sample.com/xxx.txt
    msg7086
        5
    msg7086  
       Aug 26, 2015
    location = /abcdefg.txt {
    root /var/xyz/;
    }

    这种用等号直接指定文件的规则优先级最高。
    gamexg
        6
    gamexg  
       Aug 26, 2015
    dns txt 更方便。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1001 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 19:20 · PVG 03:20 · LAX 12:20 · JFK 15:20
    ♥ Do have faith in what you're doing.