Нашел простой способ прикрутить python к nginx'у посредством cgi.
Согласно описания всё получилось, но немного не так с портами.
http:\\10.170.0.33:8000/cgi-bin/hello.ru работает, а
http:\\10.170.0.33/cgi-bin/hello.ru говорит, что "502: Bad gateway!"
Как пробросить порт 8000 на 80?
Настройки nginx такие:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
error_page 404 /404.html;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# Так сказано в инструкции:
location /cgi-bin/ {
# proxy_pass http://localhost:8000; # мои странные попытки
# listen 8000;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/ubuntu/www$fastcgi_script_name;
}
}
server {
location / {
proxy_pass http://localhost:8000;
root /usr/share/nginx/html/mysite/cgi-bin;
}
}