Linux学习小标兵,专注Linux资讯分享,技术文章分享
分类: Python/Ruby
2018-11-17 21:06:39
| 导读 | Python是一种计算机程序设计语言。是一种动态的、面向对象的脚本语言,最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越来越多被用于独立的、大型项目的开发。 |
ngx_python 是为 nginx 嵌入 python 脚本的模块。
- python 2.7.*
- nginx-1.6.3+
git clone
wget ''
tar -zxvf nginx-1.6.3.tar.gz
cd nginx-1.6.3
export PYTHON_INC=/path/to/python/include/python2.7
export PYTHON_BIN=/path/to/python/bin
./configure --user=www --group=www \
--prefix=/path/to/nginx \
--add-module=/path/to/ngx_python
nginx
user www www;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /content_by_python {
content_by_python "
import ngx
ngx.echo('Hello, ngx_python')
";
}
}
}
}