‘‘‘server { listen 12345; server_name 10.10.10.132; charset UTF-8; client_max_body_size 75M; location /static { expires 30d; autoindex on; add_header Cache-Control private; alias /home/zhangsan/git/nginxdemo/nginxdemo/static/; } location / { include uwsgi_params; uwsgi_pass 10.10.10.132:54321; uwsgi_read_timeout 2; } }‘‘‘
When you browse the Web page and find the answer, you may encounter the problem of planning static pages to write dead paths when using Django, this is indeed the reason why the uwsgi module cannot be correctly used on my own nginx server and the Django program cannot run properly. But should static files be written to death like this?
Hard coding is never a good way to Process Code. It will reduce the flexibility of your program and it feels appropriate to do so.
import os.pathimport posixpathPROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ‘..‘)STATIC_ROOT = os.path.join(PROJECT_ROOT, ‘static‘)
I am a little sleepy. I will find time tomorrow to list the advantages of this writing method and the knowledge involved.
How to install Django on nginx reverse proxy server ~