centos7简单搭建nginx+uwsgi+web.py的Python web环境(记录)
2015-01-14 11:32
721 查看
安装 Nginx
wget 下载 Nginx解压安装
./configure&&make&&make install将生成的nginx可执行文件在/usr/sbin里建立软链接
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx安装pip
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-6.0.6.tar.gz安装时出错提示没有setuptools
安装setuptoolswget
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | pythonGoogle发现pip可以直接用脚本安装:https://raw.github.com/pypa/pip/master/contrib/get-pip.py
下载后直接python get-pip.py即可
使用pip安装uwsgi(其实也可以直接下载编译安装)
pip install uwsgi注意编译后最好将编译好的uwsgi可执行文件cp到 /usr/sbin/uwsgi方便执行
安装web.py
安装方法参考官网配置:
创建app文件 app.py :(这个是webpy网站上提供的helloworld)import web urls = ( '/(.*)', 'hello' ) app = web.application(urls, globals()) class hello: def GET(self, name): if not name: name = 'World' return 'Hello, ' + name + '!' if __name__ == "__main__": app.run()
nginx:
配置文件server内添加如下内容
location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9001; }(这里的uwsgi_pass 是uwsgi服务的传递端口,根据自己需求修改)
启动nginx
uwsgi:
简单测试可以直接使用命令:uwsgi -s 127.0.0.1:9001 -w app
这时访问http://localhost 应该可以看到 Hello,World!
相关文章推荐
- linux下搭建nginx+uwsgi+web.py的python web服务器
- centos6 上用nginx 和 uwsgi 搭建 python web运行环境
- Linux下搭建基于Nginx+FastCGI+Flup+Webpy+Cheetah的Python Web环境
- CentOS + Python3.6+ Django2.0 + uwsgi + nginx + mysql web发布环境搭建
- CentOS + Python3.3 + Django1.7 + uwsgi + nginx + mysql web发布环境搭建
- 搭建python的web环境 Centos5.4+Nginx-0.8.50+UWSGI-0.9.6.2+Django-1.2.3搭建高性能WEB服务器环境
- Nginx + uWSGI + web.py 搭建示例
- CentOS+nginx+uwsgi+Python 多站点环境搭建
- CentOS+nginx+uwsgi+Python 多站点环境搭建
- virtualenv 环境下 Nginx + Flask + Gunicorn+ Supervisor 搭建 Python Web
- nginx+uwsgi+flask搭建python-web应用程序
- python + flask + uwsgi + gevent + nginx 环境搭建(非阻塞)
- Nginx+uwsgi+Django 搭建一个简单的web服务器
- CentOS+nginx+uwsgi+Python 多站点环境搭建
- Windows下Python Web开发环境搭建 (Notepad++ & Web.py)
- nginx+uwsgi部署python web(web.py)
- Centos+nginx+uwsgi+Python多站点环境搭建
- Nginx + uWSGI + web.py 搭建示例
- Nginx+uWSGI+Django+Python+ MySQL 搭建可靠的Python Web服务器
- Nginx + webpy 和FastCGI搭建webpy环境 推荐