nginx + uwsgi 배치 django [1.11.8] 에서 ubuntu 기록
10091 단어 후 단 개발 노트
버 전 번호 대로 자리 에 앉 아 주세요.
#
sudo apt-get --purge remove nginx
#
sudo apt-get update
sudo apt-get install nginx
# nginx
sudo nginx -t
# nginx, nginx
sudo service nginx restart
# Python3.x :
sudo apt-get install python3-dev
sudo apt-get install python3-pip
sudo pip3 install uwsgi
# ,
/home/yice/PycharmProjects/YC_Ops
# uwsgi.ini
sudo vim uwsgi.ini
#----------------------------uwsgi.ini --------------------------------------
# uwsgi.ini
# mysite_uwsgi.ini file
[uwsgi]
# Django-related settings
# nginx
socket=:8005
# the base directory (full path)
chdir = /home/yice/PycharmProjects/YC_Ops
# Django's wsgi file
# .wsgi
module = YC_Ops.wsgi
# the virtualenv (full path)
# home = /path/to/virtualenv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe .sock !! nginx
socket = /home/yice/PycharmProjects/YC_Ops.sock
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
#-----------------------uwsgi.ini -------------------------------------
21 server {
22 listen 80 default_server;
23 listen [::]:80 default_server;
24
25 # SSL configuration
26 #
27 # listen 443 ssl default_server;
28 # listen [::]:443 ssl default_server;
29 #
30 # Note: You should disable gzip for SSL traffic.
31 # See: https://bugs.debian.org/773332
32 #
33 # Read up on ssl_ciphers to ensure a secure configuration.
34 # See: https://bugs.debian.org/765782
35 #
36 # Self signed certs generated by the ssl-cert package
37 # Don't use them in a production server!
38 #
39 # include snippets/snakeoil.conf;
40
41 root /var/www/html;
42
43 # Add index.php to the list if you are using PHP
44 index index.html index.htm index.nginx-debian.html;
45
46 server_name localhost; # ,server_name / IP, localhost
47
48 location / {
49 # First attempt to serve request as file, then
50 # as directory, then fall back to displaying a 404.
51 include uwsgi_params;
52 uwsgi_pass 127.0.0.1:8005; # uwsgi
53 uwsgi_read_timeout 30; # , ,
54 # try_files $uri $uri/ =404; , 404
55 }
56
57 location /static {
58
59 expires 30d;
60 autoindex on;
61 add_header Cache-Control private;
62 alias /home/yice/PycharmProjects/YC_Ops/static/; # ,
63 }
64
nginx default nginx, sudo /etc/init.d/nginx restart