pip3 install uwsgi sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev liblzma-dev libffi-dev libc6-dev
在django項目的根目錄新建一個uwsgi.ini文件,寫入如下內容nginx
[uwsgi] http = :8000 # 綁定端口 chdir = /home/trunk/ # 項目主目錄 module = SpiderServer.wsgi #項目主目錄下的SpiderServer.wsgi.py文件,省略後綴 master = true processes = 4 #線程 vacuum = true daemonize=uwsgi.log #日誌文件
uwsgi --ini uwsgi.ini
使用命令行瀏覽器瀏覽127.0.0.1:8000。若是可以正常訪問,說明uwsgi工做正常sql
links 127.0.0.1:8000
wget http://nginx.org/download/nginx-1.15.12.tar.gz
tar -zxvf nginx-1.15.12.tar.gz
cd nginx-1.15.12 ./configure make&make install
nginx默認安裝在/usr/local/nginx/django
cd /usr/local/nginx/conf/
在更改nginx.conf時最好作好備份瀏覽器
備份nginx.conf cp nginx.conf nginx.con.bak
更改配置文件ide
... server { listen 80; server_name 127.0.0.1; charset utf-8; #access_log logs/host.access.log main; location / { include uwsgi_params; #重要 uwsgi_pass 127.0.0.1:8000; #重要,這裏填寫的端口必須和uwsgi.ini中綁定的端口同樣 uwsgi_read_timeout 2; } } ...
啓動nginx項目測試
# 切換到nginx執行文件所在目錄 cd /usr/local/nginx/sbin/ # 開啓nginx ./nginx
訪問es5
links 127.0.0.1