Advertisement
DeaD_EyE

Nginx: configure-nginx-for-your-site

Feb 9th, 2017
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. # http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html#configure-nginx-for-your-site
  2. # mysite_nginx.conf
  3.  
  4. # the upstream component nginx needs to connect to
  5. upstream django_1 {
  6. # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
  7. server 127.0.0.1:8001; # for a web port socket (we'll use this first)
  8. }
  9.  
  10. upstream django_2 {
  11. # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
  12. server 127.0.0.1:8002; # for a web port socket (we'll use this first)
  13. }
  14.  
  15. # configuration of the server
  16. server {
  17. # the port your site will be served on
  18. listen 80;
  19. # the domain name it will serve for
  20. server_name .example.com; # substitute your machine's IP address or FQDN
  21. charset utf-8;
  22.  
  23. # max upload size
  24. client_max_body_size 75M; # adjust to taste
  25.  
  26. # Django media
  27. location /media {
  28. alias /path/to/your/mysite/media; # your Django project's media files - amend as required
  29. }
  30.  
  31. location /static {
  32. alias /path/to/your/mysite/static; # your Django project's static files - amend as required
  33. }
  34.  
  35. # Finally, send all non-media requests to the Django server.
  36. location /app1 {
  37. uwsgi_pass django_1;
  38. include /path/to/your/mysite/uwsgi_params; # the uwsgi_params file you installed
  39. }
  40. location /app2 {
  41. uwsgi_pass django_2;
  42. include /path/to/your/mysite/uwsgi_params; # the uwsgi_params file you installed
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement