一、nginx:
1.目錄結構、常用指令和清除程序:
/usr/sbin/nginx:主程式
/etc/nginx:存放配置檔案
/usr/share/nginx:存放靜态檔案
/var/log/nginx:存放日志
2.指令:
service nginx start 啟動
service nginx restart 重新開機
service nginx stop 停止
3.清除程序:
ps aux | grep XXX
kill -9 XXX
二、uwsgi:
配置檔案啟動:
uwsgi --ini uwsgi.ini 啟動
uwsgi --stop /配置位址/uwsgi.pid 停止 ( uwsgi.ini 檔案最後一個配置行的位址)
三、nginx配置:
cd /usr/share/nginx/html
把靜态檔案放到該 目錄下
vim /etc/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
charset utf-8;
location / {
root /usr/share/nginx/html;#靜态檔案目錄
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}
}
四、uwsgi配置:
在項目settings.py同級目錄建立 uwsgi.ini 檔案
[uwsgi]
#項目目錄
chdir=/項目目錄/
module=項目名稱.wsgi:application
processes=8
workers=5
py-autoreload=1
http=0.0.0.0:8000
master=true
vacuum=true
thunder-lock=true
enable-threads=true
harakiri=30
post-buffering=4096
daemonize=%(chdir)/uwsgi.log
pidfile=%(chdir)/uwsgi.pid