利用ngx_python模塊嵌入到Python腳本
Python是一種計算機程序設計語言。是一種動態的、面向對象的腳本語言,最初被設計用於編寫自動化腳本(shell),隨著版本的不斷更新和語言新功能的添加,越來越多被用於獨立的、大型項目的開發。
ngx_python 是為 nginx 嵌入 python 腳本的模塊。
環境
- python 2.7.*
- nginx-1.6.3+
安裝
git clone https://github.com/rryqszq4/ngx_python.git wget "http://nginx.org/download/nginx-1.6.3.tar.gz" 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") "; } } } }
※向大家分享一個shell腳本的坑
※靈活的API查詢語言——GraphQL
TAG:尤沐西子 |