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
There are few and inadequate installation tutoria...
Preface Tip: The following is the main content of...
This article shares the specific code of Bootstra...
Table of contents Product Requirements Ideas Prob...
Let me first explain why the text is not vertical...
Table of contents Load Balancing Load balancing c...
1. Unzip to the location where you want to instal...
<br />I have compiled some domestic design w...
Table of contents vue2.x Pre-concept: Routing hoo...
The first article on data backup and restoration ...
First of all, the formation of web page style main...
MySQL regular sorting, custom sorting, and sortin...
This article example shares the specific code of ...
<br />In order to clearly distinguish the ta...
1. Install SVN server yum install subversion 2. C...