When deploying uwsgi+nginx proxy Django, access using uwsgi is normal, but static resources cannot be accessed when using nginx proxy port access. Solution:
uwsgi configuration: # uwsig starts using the configuration file [uwsgi] # The root directory of the project is chdir=/data/django/dailyfresh #Specify the application of the project, different from the startup command--wsgi-filemysite/wsgi.py #logsquery your own application namemodule=dailyfresh.wsgi:application #the local unix socket file than commnuincate to Nginx #Specify the file path of sock. This sock file will be configured in uwsgi_pass of nginx for communication between nginx and uwsgi. #Support ip+port mode and socket file mode #socket=/etc/uwsgi/uwsgi.sock socket=127.0.0.1:9001 # Number of processes processes = 8 # Number of workers per process workers=5 procname-prefix-spaced=dailyfresh # uwsgi process name prefix py-autoreload=1 # py file modification, automatic loading # Specify IP port, web access entry http=0.0.0.0:9000 # Start uwsgi's username and user group uid=root gid=root # Enable the master process master=true # Automatically remove unix socket and pid file when the service stops vacuum=true # Serialize received content, thunder-lock=true if possible # Enable threads enable-threads=true # Set a timeout to interrupt additional requests that exceed the server's request limit harakiri=30 # Set post-buffering=4096 # Set the log directory daemonize=/var/log/uwsgi/uwsgi.log # uWSGI process number is stored in pidfile = /etc/uwsgi/uwsgi.pid nginx configuration: server { listen 9002; server_name 192.168.2.100; access_log /var/log/test.log; error_log /var/log/test.log; charset utf-8; client_max_body_size 100M; location /static{ alias /data/django/dailyfresh/static; } location /media{ alias /data/django/dailyfresh/media; } location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9001; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } This is the end of this article about the solution to the problem that uwsgi+nginx proxy Django cannot access static resources. For more related content about uwsgi+nginx proxy Django cannot access, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Pure CSS to achieve cloudy weather icon effect
>>: Solve the problem of MySQL Threads_running surge and slow query
Write a SQL first SELECT DISTINCT from_id FROM co...
1. Why do we need to divide tables and partitions...
Table of contents Preface 1. Nginx+Tomcat 2. Conf...
What is the Vendor Prefix? Vendor prefix—Browser ...
Table of contents Preface What is DrawCall How do...
Canal is an open source project under Alibaba, de...
lsof (list open files) is a tool to view files op...
MySQL's CAST() and CONVERT() functions can be...
If your DOCTYPE is as follows: Copy code The code ...
Preface In the Linux kernel, in order to be compa...
Source of the problem As we all know, all network...
tar backup system sudo tar cvpzf backup.tgz --exc...
Portainer is a lightweight docker environment man...
This article example shares the specific code of ...
This article shares the specific code of JavaScri...