搜文章
推荐 原创 视频 Java开发 iOS开发 前端开发 JavaScript开发 Android开发 PHP开发 数据库 开发工具 Python开发 Kotlin开发 Ruby开发 .NET开发 服务器运维 开放平台 架构师 大数据 云计算 人工智能 开发语言 其它开发
Lambda在线 > Python程序设计教程 > linux+flask+uswgi+nginx

linux+flask+uswgi+nginx

Python程序设计教程 2020-05-21

pip install uwsgi

(env_rqalpha) [anaconda@anaconda ~]$

uwsgi

uwsgi: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

01


                                        标题内容1

ldconfig -v


wget ftp://ftp.fi.muni.cz/pub/openssl/source/openssl-1.1.1g.tar.gztar -zxvf open...cd openssl...../config --prefix=/usr/local/openssl-1.1.1gmake && make installcd /usr/local/openssl-1.1.1g/ldd bin/openssl

linux-vdso.so.1 =>  (0x00007ffc26df8000)
    libssl.so.1.1 => not found
    libcrypto.so.1.1 => not found
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f33d09ba000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f33d079e000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f33d03d0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f33d0bbe000)


[root@anaconda openssl-1.1.1g]#

./bin/openssl version

./bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

echo "/usr/local/openssl-1.1.1g/lib/">>/etc/ld.so.conf
mv /usr/bin/openssl /usr/bin/openssl.oldln -s /usr/local/openssl-1.1.1g/bin/openssl /usr/bin/openssl
(env_rqalpha) [anaconda@anaconda ~]$ openssl version

OpenSSL 1.1.1g  21 Apr 2020

(env_rqalpha) [anaconda@anaconda ~]$ uwsgi

*** Starting uWSGI 2.0.18 (64bit) on [Mon May 18 10:37:02 2020] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-39) on 18 May 2020 01:57:21
os: Linux-3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020
nodename: anaconda.zjupress
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/anaconda
detected binary path: /home/anaconda/anaconda3/envs/env_rqalpha/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 4096
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
The -s/--socket option is missing and stdin is not a socket.


02


标题内容2


vi uwsgi.ini

[uwsgi]
master=true
http=127.0.0.1:5000
pythonpath=/home/anaconda/PycharmProjects/statistics
chdir=/home/anaconda/PycharmProjects/statistics
wsgi-file=/home/anaconda/PycharmProjects/statistics/app.py
callable=app
processes=4
threads=2
buffer-size=65536
vacuum=true
pidfile=/home/anaconda/uwsgi.pid

uwsgi uwsgi.ini

[uWSGI] getting INI configuration from uwsgi.ini
*** Starting uWSGI 2.0.18 (64bit) on [Mon May 18 10:58:52 2020] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-39) on 18 May 2020 01:57:21
os: Linux-3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020
nodename: anaconda.zjupress
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/anaconda/PycharmProjects/statistics
writing pidfile to /home/anaconda/uwsgi.pid
detected binary path: /home/anaconda/anaconda3/envs/env_rqalpha/bin/uwsgi
chdir() to /home/anaconda/PycharmProjects/statistics
your processes number limit is 4096
your memory page size is 4096 bytes
detected max file descriptor number: 4096
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 127.0.0.1:5000 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:33227 (port auto-assigned) fd 3
Python version: 3.8.2 (default, May  7 2020, 20:00:49)  [GCC 7.3.0]
Python main interpreter initialized at 0x2399ff0
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1031270 bytes (1007 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
added /home/anaconda/PycharmProjects/statistics/ to pythonpath.
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x2399ff0 pid: 6679 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 6679)
spawned uWSGI worker 1 (pid: 6681, cores: 2)
spawned uWSGI worker 2 (pid: 6682, cores: 2)
spawned uWSGI worker 3 (pid: 6683, cores: 2)
spawned uWSGI worker 4 (pid: 6686, cores: 2)
spawned uWSGI http 1 (pid: 6688)

dakailiulangqi:

http://127.0.0.1:5000/


hellowworld


03


nginx


进入 vi /etc/nginx/nginx.conf文件

vi /usr/local/nginx/conf

location / {

            #root   html;

            #index  index.html index.htm;

            uwsgi_pass 127.0.0.1:8201;

            include uwsgi_params;

            #proxy_pass http://127.0.0.1:5001;

            #proxy_set_header Host $host;

        }

service nginx start


firewall-cmd --state

running

netstat -lnpt

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1844/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1380/sshd           
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1379/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1818/master         
tcp        0      0 127.0.0.1:5000          0.0.0.0:*               LISTEN      4663/uwsgi          
tcp        0      0 127.0.0.1:45929         0.0.0.0:*               LISTEN      4663/uwsgi          
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      899/rpcbind         
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      6444/nginx: master  
tcp6       0      0 :::22                   :::*                    LISTEN      1380/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1379/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1818/master         
tcp6       0      0 :::111                  :::*                    LISTEN      899/rpcbind    

04


                                           nginx


cd /etc/init.dvi uwsgi.sh
#!/bin/bash -e/home/anaconda/anaconda3/bin/uwsgi --ini /home/anaconda/PycharmProjects/statistics/uwsgi.iniwsgi.ini

chmod 755 uwsgi.sh

赋予脚本可执行权限(/opt/script/uwsgi.sh是你的脚本路径)

1

# chmod +x /opt/script/uwsgi.sh 


./uwsgi.sh
systemctl start nginx

=======================================================

本号旨在打造一个小白Python学习社区。学习社区主要聚焦于Python编程、科学数据、可视化、机器学习、金融大数据量化等内容。学习内容一篇文章控制在15-20分钟左右。欢迎大家留言交流。


======================================================







版权声明:本站内容全部来自于腾讯微信公众号,属第三方自助推荐收录。《linux+flask+uswgi+nginx》的版权归原作者「Python程序设计教程」所有,文章言论观点不代表Lambda在线的观点, Lambda在线不承担任何法律责任。如需删除可联系QQ:516101458

文章来源: 阅读原文

相关阅读

关注Python程序设计教程微信公众号

Python程序设计教程微信公众号:programL

Python程序设计教程

手机扫描上方二维码即可关注Python程序设计教程微信公众号

Python程序设计教程最新文章

精品公众号随机推荐