Cenots下nginx+uwsgi+web.py环境部署总结

 1、安装Nginx:

unzip pcre-8.20.zip

cd pcre-8.20

./configure

make

make install

tar xvf nginx-1.3.1.tar.gz 

cd nginx-1.3.1

mkdir -p /data/www/

mkdir -p /data/nginx_logs

/usr/sbin/groupadd www

/usr/sbin/useradd -m www -g www -s /sbin/nologin -d /usr/local/nginx

chown -R www:www /data/www

chown -R www:www /data/nginx_logs

./configure  --prefix=/usr/local/nginx  --with-http_stub_status_module --with-http_ssl_module --user=www --group=www --with-http_realip_module --with-http_flv_module --with-http_gzip_static_module

make

make install

 

2、升级python2.7

tar xvf Python-2.7.3.tgz 

cd Python-2.7.3

./configure

make all

make install

make clena

make clean

make distclean

 

 

mv /usr/bin/python /usr/bin/python.bak

ln -sv /usr/local/bin/python2.7 /usr/bin/python

vi /usr/bin/yum

 

sed -i s@/usr/bin/python@/usr/bin/python2.4@ /usr/bin/yum

 

3、安装setuptools

tar xvf setuptools-0.6c11.tar.gz 

cd setuptools-0.6c11

python setup.py build

python setup.py install

 

4、安装web.py

tar xvf web.py-0.36.tar.gz 

cd web.py-0.36

python setup.py install

 

5、安装Mysql5.5

   参考:http://lihuipeng.blog.51cto.com/3064864/561862

 

6、安装Mysql_python

tar xvf MySQL-python-1.2.3.tar.gz

cd MySQL-python-1.2.3

vi site.cfg

把 mysql_config = /usr/local/mysql/bin/mysql_config 这一行前的#去掉,并且把mysql_config的路径设置正确

python setup.py build

python setup.py install

cd ..

rm -rf MySQL-python-1.2.3

 

7、安装uwsgi

tar xvf uwsgi-1.2.3.tar.gz

cd uwsgi-1.2.3

python uwsgiconfig.py --build

python setup.py install

 

8、配置nginx

       server {

                listen       80;

                server_name  192.168.190.129;

                location / {

                        include uwsgi_params;

                        uwsgi_pass 127.0.0.1:9090;

                }

        }

 

9、启动uwsgi

  创建index.py文件:

#!/usr/bin/python

# -*- coding: utf-8 -*-

import web 

urls = ("/.*", "hello")

class hello:

    def GET(self):

        return 'Hello, world!'

app = web.application(urls, globals())

application = app.wsgifunc()

 

启动uwsgi

uwsgi -s :9091 -w index -p 2 -d uws.error &

 本文转自运维笔记博客51CTO博客,原文链接http://blog.51cto.com/lihuipeng/907824如需转载请自行联系原作者


lihuipeng

你可能感兴趣的:(数据库,运维,python)