安裝nginx
> rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
> yum -y install nginx
安裝uwsgi
pip3 install uwsgi
配置nginx
server {
listen 99.99.99.250:7000 ssl;
server_name nac.innotechx.com:7000;
ssl_certificate /opt/key/server.pem; // 證書(shū)配置
ssl_certificate_key /opt/key/server.key; // 證書(shū)配置
ssl_session_timeout 20m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://127.0.0.1:8001/; #用來(lái)和uWSGI進(jìn)行通訊的
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
real_ip_recursive on;
proxy_max_temp_file_size 0;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
使用uwsgi啟動(dòng)django項(xiàng)目
/usr/local/bin/uwsgi --http-socket 127.0.0.1:8001 --chdir /opt/pfcode/pfauto/ --wsgi-file /opt/pfcode/pfauto/PFAuto/wsgi.py --master --processes 2 --threads 2 --threads 2 --daemonize /var/log/uwsgi.log
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。