centos7上安装nginx+uwsgi搭建项目

2018-04-25  本文已影响0人  信仰与初衷

*安装nginx

yum instal  nginx
pip install uwsgi
mkdir /etc/uwsgi
vim /etc/uwsgi/uwsgi.ini
[uwsgi]
socket = 127.0.0.1:9090
master = true         
wsgi-file=/var/www/html/python/test.py
#vhost = true          
no-site = true        
workers = 2           
reload-mercy = 10     
vacuum = true        
max-requests = 1000   
limit-as = 512
buffer-size = 30000
pidfile = /var/run/uwsgi9090.pid    
daemonize = /var/log/uwsgi9090.log
mkdir /var/www/html/python/
vim test.py

写文件

def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return "Hello World"
vim /etc/nginx/conf.d/python.conf

插入下面

server {
    listen       8090;
    server_name 127.0.0.1;

    location / {
    include  uwsgi_params;
        uwsgi_pass  127.0.0.1:9090;        
    }
}
systemctl start nginx
uwsgi /etc/uwsgi/uwsgi.ini

如此,则成功了,接下来你可以愉快地使用python进行项目开发了

上一篇 下一篇

猜你喜欢

热点阅读